-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mantine.dev] Add SemiCircleProgress demos
- Loading branch information
Showing
8 changed files
with
155 additions
and
6 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
...ocs/demos/src/demos/core/SemiCircleProgress/SemiCircleProgress.demo.emptySegmentColor.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { SemiCircleProgress } from '@mantine/core'; | ||
import { MantineDemo } from '@mantinex/demo'; | ||
|
||
const code = ` | ||
import { SemiCircleProgress } from '@mantine/core'; | ||
function Demo() { | ||
return <SemiCircleProgress value={30} emptySegmentColor="var(--mantine-color-dimmed)" />; | ||
} | ||
`; | ||
|
||
function Demo() { | ||
return <SemiCircleProgress value={30} emptySegmentColor="var(--mantine-color-dimmed)" />; | ||
} | ||
|
||
export const emptySegmentColor: MantineDemo = { | ||
type: 'code', | ||
component: Demo, | ||
code, | ||
centered: true, | ||
}; |
31 changes: 31 additions & 0 deletions
31
...s/@docs/demos/src/demos/core/SemiCircleProgress/SemiCircleProgress.demo.labelPosition.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { SemiCircleProgress } from '@mantine/core'; | ||
import { MantineDemo } from '@mantinex/demo'; | ||
|
||
const code = ` | ||
import { SemiCircleProgress } from '@mantine/core'; | ||
function Demo() { | ||
return ( | ||
<> | ||
<SemiCircleProgress value={30} label="Bottom" mb="xl" /> | ||
<SemiCircleProgress value={30} label="Center" labelPosition="center" /> | ||
</> | ||
); | ||
} | ||
`; | ||
|
||
function Demo() { | ||
return ( | ||
<> | ||
<SemiCircleProgress value={30} label="Bottom" mb="xl" /> | ||
<SemiCircleProgress value={30} label="Center" labelPosition="center" /> | ||
</> | ||
); | ||
} | ||
|
||
export const labelPosition: MantineDemo = { | ||
type: 'code', | ||
component: Demo, | ||
code, | ||
centered: true, | ||
}; |
43 changes: 43 additions & 0 deletions
43
...ges/@docs/demos/src/demos/core/SemiCircleProgress/SemiCircleProgress.demo.transitions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useState } from 'react'; | ||
import { Button, SemiCircleProgress } from '@mantine/core'; | ||
import { MantineDemo } from '@mantinex/demo'; | ||
|
||
const code = ` | ||
import { useState } from 'react'; | ||
import { Button, SemiCircleProgress } from '@mantine/core'; | ||
function Demo() { | ||
const [value, setValue] = useState(30); | ||
return ( | ||
<> | ||
<SemiCircleProgress value={value} transitionDuration={250} label={\`\${value}%\`} /> | ||
<Button onClick={() => setValue(Math.floor(Math.random() * 100))} mt="xl" fullWidth> | ||
Set random value | ||
</Button> | ||
</> | ||
); | ||
} | ||
`; | ||
|
||
function Demo() { | ||
const [value, setValue] = useState(30); | ||
|
||
return ( | ||
<> | ||
<SemiCircleProgress value={value} transitionDuration={250} label={`${value}%`} /> | ||
|
||
<Button onClick={() => setValue(Math.floor(Math.random() * 100))} mt="xl" fullWidth> | ||
Set random value | ||
</Button> | ||
</> | ||
); | ||
} | ||
|
||
export const transitions: MantineDemo = { | ||
type: 'code', | ||
component: Demo, | ||
code, | ||
centered: true, | ||
}; |
27 changes: 27 additions & 0 deletions
27
packages/@docs/demos/src/demos/core/SemiCircleProgress/SemiCircleProgress.demo.usage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { SemiCircleProgress } from '@mantine/core'; | ||
import { MantineDemo } from '@mantinex/demo'; | ||
|
||
const code = ` | ||
import { SemiCircleProgress } from '@mantine/core'; | ||
function Demo() { | ||
return <SemiCircleProgress{{props}} />; | ||
} | ||
`; | ||
|
||
function Wrapper(props: any) { | ||
return <SemiCircleProgress {...props} />; | ||
} | ||
|
||
export const usage: MantineDemo = { | ||
type: 'configurator', | ||
component: Wrapper, | ||
code, | ||
centered: true, | ||
controls: [ | ||
{ type: 'color', prop: 'filledSegmentColor', initialValue: 'blue', libraryValue: null }, | ||
{ type: 'number', prop: 'size', min: 70, max: 270, initialValue: 200, libraryValue: null }, | ||
{ type: 'number', prop: 'thickness', min: 1, max: 20, initialValue: 12, libraryValue: null }, | ||
{ type: 'number', prop: 'value', min: 0, max: 100, initialValue: 40, libraryValue: null }, | ||
], | ||
}; |
24 changes: 24 additions & 0 deletions
24
packages/@docs/demos/src/demos/core/SemiCircleProgress/SemiCircleProgress.demos.story.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { renderDemo } from '../../../render-demo'; | ||
import * as demos from './index'; | ||
|
||
export default { title: 'SemiCircleProgress' }; | ||
|
||
export const Demo_usage = { | ||
name: '⭐ Demo: usage', | ||
render: renderDemo(demos.usage), | ||
}; | ||
|
||
export const Demo_emptySegmentColor = { | ||
name: '⭐ Demo: emptySegmentColor', | ||
render: renderDemo(demos.emptySegmentColor), | ||
}; | ||
|
||
export const Demo_labelPosition = { | ||
name: '⭐ Demo: labelPosition', | ||
render: renderDemo(demos.labelPosition), | ||
}; | ||
|
||
export const Demo_transitions = { | ||
name: '⭐ Demo: transitions', | ||
render: renderDemo(demos.transitions), | ||
}; |
4 changes: 4 additions & 0 deletions
4
packages/@docs/demos/src/demos/core/SemiCircleProgress/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { usage } from './SemiCircleProgress.demo.usage'; | ||
export { emptySegmentColor } from './SemiCircleProgress.demo.emptySegmentColor'; | ||
export { labelPosition } from './SemiCircleProgress.demo.labelPosition'; | ||
export { transitions } from './SemiCircleProgress.demo.transitions'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters