Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
create new design system component
Sara Vieira81e526923e4e
diff --git a/apps/designer/app/designer/features/sidebar-left/panels/components/uploading-animation.tsx b/apps/designer/app/designer/features/sidebar-left/panels/components/uploading-animation.tsxindex 10f319d60b..588feffa83 100644--- a/apps/designer/app/designer/features/sidebar-left/panels/components/uploading-animation.tsx+++ b/apps/designer/app/designer/features/sidebar-left/panels/components/uploading-animation.tsx@@ -1,3 +1,5 @@+import { ProgressRadial } from "@webstudio-is/design-system";+import { useState } from "react";import { useInterval } from "react-use";@@ -14,7 +16,7 @@ const useFakeProgress = ({useInterval(() => {setProgressBarPercentage((percentage) =>- percentage < 100 ? percentage + 1 : percentage+ percentage < 60 ? percentage + 1 : percentage);},isUploading || isDeleting ? 100 : null@@ -32,30 +34,10 @@ export const UploadingAnimation = ({}) => {const progressBarPercentage = useFakeProgress({ isUploading, isDeleting });return (- <svg- style={{ position: "relative", zIndex: 10 }}- width="64"- height="64"- viewBox="0 0 64 64"- fill="none"- xmlns="http://www.w3.org/2000/svg"- >- <circle cx="32" cy="32" r="24" fill="#11181C" />- <path- d="M36.3989 32.0385C36.9929 32.616 37.9425 32.6026 38.52 32.0086C39.0975 31.4147 39.0841 30.465 38.4901 29.8875L36.3989 32.0385ZM32.1112 25.7778L33.1568 24.7023C32.5746 24.1363 31.6477 24.1363 31.0655 24.7023L32.1112 25.7778ZM25.7322 29.8875C25.1382 30.465 25.1249 31.4147 25.7023 32.0086C26.2798 32.6026 27.2295 32.616 27.8234 32.0385L25.7322 29.8875ZM30.6112 38.2223C30.6112 39.0507 31.2827 39.7223 32.1112 39.7223C32.9396 39.7223 33.6112 39.0507 33.6112 38.2223H30.6112ZM38.4901 29.8875L33.1568 24.7023L31.0655 26.8533L36.3989 32.0385L38.4901 29.8875ZM31.0655 24.7023L25.7322 29.8875L27.8234 32.0385L33.1568 26.8533L31.0655 24.7023ZM33.6112 38.2223V25.7778H30.6112V38.2223H33.6112Z"- fill="white"- />- <circle- fill="none"- stroke="white"- strokeWidth="4"- cx="32"- cy="32"- r="18"- strokeDasharray={360}- strokeLinecap="round"- strokeDashoffset={360 - progressBarPercentage * 3.6}- ></circle>- </svg>+ <ProgressRadial+ css={{ position: "relative", zIndex: 10 }}+ value={progressBarPercentage}+ max={60}+ />);};diff --git a/packages/design-system/src/components/progress-radial.tsx b/packages/design-system/src/components/progress-radial.tsxnew file mode 100644index 0000000000..b350761701--- /dev/null+++ b/packages/design-system/src/components/progress-radial.tsx@@ -0,0 +1,53 @@+import React from "react";+import { CSS } from "../stitches.config";+import * as ProgressPrimitive from "@radix-ui/react-progress";+import { Box } from "./box";++type ProgressBarPrimitiveProps = React.ComponentProps<+ typeof ProgressPrimitive.Root+>;+type ProgressRadialProps = ProgressBarPrimitiveProps & { css?: CSS };++export const ProgressRadial = React.forwardRef<+ React.ElementRef<typeof ProgressPrimitive.Root>,+ ProgressRadialProps+>(({ value, max = 100, css, ...props }, forwardedRef) => {+ const percentage = value != null ? Math.round((value / max) * 100) : 0;+ const multiplicate = 360 / max;++ return (+ <ProgressPrimitive.Root+ {...props}+ value={value}+ max={max}+ ref={forwardedRef}+ >+ <Box+ css={css}+ as="svg"+ width="64"+ height="64"+ viewBox="0 0 64 64"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ <circle cx="32" cy="32" r="24" fill="#11181C" />+ <path+ d="M36.3989 32.0385C36.9929 32.616 37.9425 32.6026 38.52 32.0086C39.0975 31.4147 39.0841 30.465 38.4901 29.8875L36.3989 32.0385ZM32.1112 25.7778L33.1568 24.7023C32.5746 24.1363 31.6477 24.1363 31.0655 24.7023L32.1112 25.7778ZM25.7322 29.8875C25.1382 30.465 25.1249 31.4147 25.7023 32.0086C26.2798 32.6026 27.2295 32.616 27.8234 32.0385L25.7322 29.8875ZM30.6112 38.2223C30.6112 39.0507 31.2827 39.7223 32.1112 39.7223C32.9396 39.7223 33.6112 39.0507 33.6112 38.2223H30.6112ZM38.4901 29.8875L33.1568 24.7023L31.0655 26.8533L36.3989 32.0385L38.4901 29.8875ZM31.0655 24.7023L25.7322 29.8875L27.8234 32.0385L33.1568 26.8533L31.0655 24.7023ZM33.6112 38.2223V25.7778H30.6112V38.2223H33.6112Z"+ fill="white"+ />+ <circle+ fill="none"+ stroke="white"+ strokeWidth="3"+ cx="32"+ cy="32"+ r="18"+ strokeDasharray={360}+ strokeDashoffset={360 - percentage * multiplicate}+ ></circle>+ </Box>+ </ProgressPrimitive.Root>+ );+});+ProgressRadial.displayName = "ProgressRadial";diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.tsindex a1e17d0d5d..80cce17b23 100644--- a/packages/design-system/src/index.ts+++ b/packages/design-system/src/index.ts@@ -20,6 +20,7 @@ export * from "@radix-ui/react-id";export { Container } from "./components/container";export { Label } from "./components/label";export * as ToggleGroup from "./components/toggle-group";+export * from "./components/progress-radial";export * from "./components/select";export { TextField } from "./components/text-field";export { Flex } from "./components/flex";