Skip to content

Commit

Permalink
refactor(docs): circular-progress dx (#4029)
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong authored Nov 13, 2024
1 parent e44916c commit 9590950
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 108 deletions.
14 changes: 14 additions & 0 deletions apps/docs/content/components/circular-progress/colors.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {CircularProgress} from "@nextui-org/react";

export default function App() {
return (
<div className="flex gap-4">
<CircularProgress aria-label="Loading..." color="default" />
<CircularProgress aria-label="Loading..." color="primary" />
<CircularProgress aria-label="Loading..." color="secondary" />
<CircularProgress aria-label="Loading..." color="success" />
<CircularProgress aria-label="Loading..." color="warning" />
<CircularProgress aria-label="Loading..." color="danger" />
</div>
);
}
15 changes: 1 addition & 14 deletions apps/docs/content/components/circular-progress/colors.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
const App = `import {CircularProgress} from "@nextui-org/react";
export default function App() {
return (
<div className="flex gap-4">
<CircularProgress color="default" aria-label="Loading..."/>
<CircularProgress color="primary" aria-label="Loading..."/>
<CircularProgress color="secondary" aria-label="Loading..."/>
<CircularProgress color="success" aria-label="Loading..."/>
<CircularProgress color="warning" aria-label="Loading..."/>
<CircularProgress color="danger" aria-label="Loading..."/>
</div>
);
}`;
import App from "./colors.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {CircularProgress, Card, CardBody, CardFooter, Chip} from "@nextui-org/react";

export default function App() {
return (
<Card className="w-[240px] h-[240px] border-none bg-gradient-to-br from-violet-500 to-fuchsia-500">
<CardBody className="justify-center items-center pb-0">
<CircularProgress
classNames={{
svg: "w-36 h-36 drop-shadow-md",
indicator: "stroke-white",
track: "stroke-white/10",
value: "text-3xl font-semibold text-white",
}}
showValueLabel={true}
strokeWidth={4}
value={70}
/>
</CardBody>
<CardFooter className="justify-center items-center pt-0">
<Chip
classNames={{
base: "border-1 border-white/30",
content: "text-white/90 text-small font-semibold",
}}
variant="bordered"
>
2800 Data points
</Chip>
</CardFooter>
</Card>
);
}
33 changes: 1 addition & 32 deletions apps/docs/content/components/circular-progress/custom-styles.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,4 @@
const App = `import {CircularProgress, Card, CardBody, CardFooter, Chip} from "@nextui-org/react";
export default function App() {
return (
<Card className="w-[240px] h-[240px] border-none bg-gradient-to-br from-violet-500 to-fuchsia-500">
<CardBody className="justify-center items-center pb-0">
<CircularProgress
classNames={{
svg: "w-36 h-36 drop-shadow-md",
indicator: "stroke-white",
track: "stroke-white/10",
value: "text-3xl font-semibold text-white",
}}
value={70}
strokeWidth={4}
showValueLabel={true}
/>
</CardBody>
<CardFooter className="justify-center items-center pt-0">
<Chip
classNames={{
base: "border-1 border-white/30",
content: "text-white/90 text-small font-semibold",
}}
variant="bordered"
>
2800 Data points
</Chip>
</CardFooter>
</Card>
);
}`;
import App from "./custom-styles.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down
5 changes: 5 additions & 0 deletions apps/docs/content/components/circular-progress/label.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {CircularProgress} from "@nextui-org/react";

export default function App() {
return <CircularProgress label="Loading..." />;
}
8 changes: 1 addition & 7 deletions apps/docs/content/components/circular-progress/label.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
const App = `import {CircularProgress} from "@nextui-org/react";
export default function App() {
return (
<CircularProgress label="Loading..." />
);
}`;
import App from "./label.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down
11 changes: 11 additions & 0 deletions apps/docs/content/components/circular-progress/sizes.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {CircularProgress} from "@nextui-org/react";

export default function App() {
return (
<div className="flex gap-4">
<CircularProgress aria-label="Loading..." size="sm" />
<CircularProgress aria-label="Loading..." size="md" />
<CircularProgress aria-label="Loading..." size="lg" />
</div>
);
}
12 changes: 1 addition & 11 deletions apps/docs/content/components/circular-progress/sizes.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
const App = `import {CircularProgress} from "@nextui-org/react";
export default function App() {
return (
<div className="flex gap-4">
<CircularProgress size="sm" aria-label="Loading..."/>
<CircularProgress size="md" aria-label="Loading..."/>
<CircularProgress size="lg" aria-label="Loading..."/>
</div>
);
}`;
import App from "./sizes.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down
5 changes: 5 additions & 0 deletions apps/docs/content/components/circular-progress/usage.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {CircularProgress} from "@nextui-org/react";

export default function App() {
return <CircularProgress aria-label="Loading..." />;
}
8 changes: 1 addition & 7 deletions apps/docs/content/components/circular-progress/usage.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
const App = `import {CircularProgress} from "@nextui-org/react";
export default function App() {
return (
<CircularProgress aria-label="Loading..." />
);
}`;
import App from "./usage.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {CircularProgress} from "@nextui-org/react";

export default function App() {
return (
<CircularProgress
color="success"
formatOptions={{style: "unit", unit: "kilometer"}}
label="Speed"
showValueLabel={true}
size="lg"
value={70}
/>
);
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
const App = `import {CircularProgress} from "@nextui-org/react";
export default function App() {
return (
<CircularProgress
label="Speed"
size="lg"
value={70}
color="success"
formatOptions={{ style: "unit", unit: "kilometer" }}
showValueLabel={true}
/>
);
}`;
import App from "./value-formatting.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down
23 changes: 23 additions & 0 deletions apps/docs/content/components/circular-progress/value.raw.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<CircularProgress
aria-label="Loading..."
color="warning"
showValueLabel={true}
size="lg"
value={value}
/>
);
}
24 changes: 1 addition & 23 deletions apps/docs/content/components/circular-progress/value.ts
Original file line number Diff line number Diff line change
@@ -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 (
<CircularProgress
aria-label="Loading..."
size="lg"
value={value}
color="warning"
showValueLabel={true}
/>
);
}`;
import App from "./value.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down

0 comments on commit 9590950

Please sign in to comment.