From 9590950555c8086118dc824c75e2d26670b69889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D5=A1=D3=84=D5=A1?= Date: Thu, 14 Nov 2024 04:30:57 +0800 Subject: [PATCH] refactor(docs): circular-progress dx (#4029) --- .../circular-progress/colors.raw.jsx | 14 ++++++++ .../components/circular-progress/colors.ts | 15 +-------- .../circular-progress/custom-styles.raw.jsx | 32 ++++++++++++++++++ .../circular-progress/custom-styles.ts | 33 +------------------ .../circular-progress/label.raw.jsx | 5 +++ .../components/circular-progress/label.ts | 8 +---- .../circular-progress/sizes.raw.jsx | 11 +++++++ .../components/circular-progress/sizes.ts | 12 +------ .../circular-progress/usage.raw.jsx | 5 +++ .../components/circular-progress/usage.ts | 8 +---- .../value-formatting.raw.jsx | 14 ++++++++ .../circular-progress/value-formatting.ts | 15 +-------- .../circular-progress/value.raw.jsx | 23 +++++++++++++ .../components/circular-progress/value.ts | 24 +------------- 14 files changed, 111 insertions(+), 108 deletions(-) create mode 100644 apps/docs/content/components/circular-progress/colors.raw.jsx create mode 100644 apps/docs/content/components/circular-progress/custom-styles.raw.jsx create mode 100644 apps/docs/content/components/circular-progress/label.raw.jsx create mode 100644 apps/docs/content/components/circular-progress/sizes.raw.jsx create mode 100644 apps/docs/content/components/circular-progress/usage.raw.jsx create mode 100644 apps/docs/content/components/circular-progress/value-formatting.raw.jsx create mode 100644 apps/docs/content/components/circular-progress/value.raw.jsx diff --git a/apps/docs/content/components/circular-progress/colors.raw.jsx b/apps/docs/content/components/circular-progress/colors.raw.jsx new file mode 100644 index 0000000000..09e7cc6aa1 --- /dev/null +++ b/apps/docs/content/components/circular-progress/colors.raw.jsx @@ -0,0 +1,14 @@ +import {CircularProgress} from "@nextui-org/react"; + +export default function App() { + return ( +
+ + + + + + +
+ ); +} diff --git a/apps/docs/content/components/circular-progress/colors.ts b/apps/docs/content/components/circular-progress/colors.ts index 2a8fff62a5..d5bef810aa 100644 --- a/apps/docs/content/components/circular-progress/colors.ts +++ b/apps/docs/content/components/circular-progress/colors.ts @@ -1,17 +1,4 @@ -const App = `import {CircularProgress} from "@nextui-org/react"; - -export default function App() { - return ( -
- - - - - - -
- ); -}`; +import App from "./colors.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/circular-progress/custom-styles.raw.jsx b/apps/docs/content/components/circular-progress/custom-styles.raw.jsx new file mode 100644 index 0000000000..8e2f2d9e64 --- /dev/null +++ b/apps/docs/content/components/circular-progress/custom-styles.raw.jsx @@ -0,0 +1,32 @@ +import {CircularProgress, Card, CardBody, CardFooter, Chip} from "@nextui-org/react"; + +export default function App() { + return ( + + + + + + + 2800 Data points + + + + ); +} diff --git a/apps/docs/content/components/circular-progress/custom-styles.ts b/apps/docs/content/components/circular-progress/custom-styles.ts index 53b74c16c2..da3ea9093a 100644 --- a/apps/docs/content/components/circular-progress/custom-styles.ts +++ b/apps/docs/content/components/circular-progress/custom-styles.ts @@ -1,35 +1,4 @@ -const App = `import {CircularProgress, Card, CardBody, CardFooter, Chip} from "@nextui-org/react"; - -export default function App() { - return ( - - - - - - - 2800 Data points - - - - ); -}`; +import App from "./custom-styles.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/circular-progress/label.raw.jsx b/apps/docs/content/components/circular-progress/label.raw.jsx new file mode 100644 index 0000000000..7767e1e4f8 --- /dev/null +++ b/apps/docs/content/components/circular-progress/label.raw.jsx @@ -0,0 +1,5 @@ +import {CircularProgress} from "@nextui-org/react"; + +export default function App() { + return ; +} diff --git a/apps/docs/content/components/circular-progress/label.ts b/apps/docs/content/components/circular-progress/label.ts index e9bd60e770..254b95afb8 100644 --- a/apps/docs/content/components/circular-progress/label.ts +++ b/apps/docs/content/components/circular-progress/label.ts @@ -1,10 +1,4 @@ -const App = `import {CircularProgress} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./label.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/circular-progress/sizes.raw.jsx b/apps/docs/content/components/circular-progress/sizes.raw.jsx new file mode 100644 index 0000000000..cdf5cdb24f --- /dev/null +++ b/apps/docs/content/components/circular-progress/sizes.raw.jsx @@ -0,0 +1,11 @@ +import {CircularProgress} from "@nextui-org/react"; + +export default function App() { + return ( +
+ + + +
+ ); +} diff --git a/apps/docs/content/components/circular-progress/sizes.ts b/apps/docs/content/components/circular-progress/sizes.ts index ef5050c7a3..85a2f5b30b 100644 --- a/apps/docs/content/components/circular-progress/sizes.ts +++ b/apps/docs/content/components/circular-progress/sizes.ts @@ -1,14 +1,4 @@ -const App = `import {CircularProgress} from "@nextui-org/react"; - -export default function App() { - return ( -
- - - -
- ); -}`; +import App from "./sizes.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/circular-progress/usage.raw.jsx b/apps/docs/content/components/circular-progress/usage.raw.jsx new file mode 100644 index 0000000000..fb6ac8e2ac --- /dev/null +++ b/apps/docs/content/components/circular-progress/usage.raw.jsx @@ -0,0 +1,5 @@ +import {CircularProgress} from "@nextui-org/react"; + +export default function App() { + return ; +} diff --git a/apps/docs/content/components/circular-progress/usage.ts b/apps/docs/content/components/circular-progress/usage.ts index ab4db2bbda..1118304c37 100644 --- a/apps/docs/content/components/circular-progress/usage.ts +++ b/apps/docs/content/components/circular-progress/usage.ts @@ -1,10 +1,4 @@ -const App = `import {CircularProgress} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./usage.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/circular-progress/value-formatting.raw.jsx b/apps/docs/content/components/circular-progress/value-formatting.raw.jsx new file mode 100644 index 0000000000..81112502da --- /dev/null +++ b/apps/docs/content/components/circular-progress/value-formatting.raw.jsx @@ -0,0 +1,14 @@ +import {CircularProgress} from "@nextui-org/react"; + +export default function App() { + return ( + + ); +} diff --git a/apps/docs/content/components/circular-progress/value-formatting.ts b/apps/docs/content/components/circular-progress/value-formatting.ts index 498c16ff29..0cd558d45d 100644 --- a/apps/docs/content/components/circular-progress/value-formatting.ts +++ b/apps/docs/content/components/circular-progress/value-formatting.ts @@ -1,17 +1,4 @@ -const App = `import {CircularProgress} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./value-formatting.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/circular-progress/value.raw.jsx b/apps/docs/content/components/circular-progress/value.raw.jsx new file mode 100644 index 0000000000..fc075f67ac --- /dev/null +++ b/apps/docs/content/components/circular-progress/value.raw.jsx @@ -0,0 +1,23 @@ +import {CircularProgress} from "@nextui-org/react"; + +export default function App() { + const [value, setValue] = React.useState(0); + + React.useEffect(() => { + const interval = setInterval(() => { + setValue((v) => (v >= 100 ? 0 : v + 10)); + }, 500); + + return () => clearInterval(interval); + }, []); + + return ( + + ); +} diff --git a/apps/docs/content/components/circular-progress/value.ts b/apps/docs/content/components/circular-progress/value.ts index 1915a88907..e2de0e9024 100644 --- a/apps/docs/content/components/circular-progress/value.ts +++ b/apps/docs/content/components/circular-progress/value.ts @@ -1,26 +1,4 @@ -const App = `import {CircularProgress} from "@nextui-org/react"; - -export default function App() { - const [value, setValue] = React.useState(0); - - React.useEffect(() => { - const interval = setInterval(() => { - setValue((v) => (v >= 100 ? 0 : v + 10)); - }, 500); - - return () => clearInterval(interval); - }, []); - - return ( - - ); -}`; +import App from "./value.raw.jsx?raw"; const react = { "/App.jsx": App,