-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #445 from omnifed/441-feat-make-progressbar-component
441 feat make progressbar component
- Loading branch information
Showing
16 changed files
with
262 additions
and
50 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
'use client' | ||
|
||
import { Input, type InputProps } from '@cerberus-design/react' | ||
import type { TextResult } from './helpers' | ||
|
||
interface BuilderInputProps | ||
extends Omit<InputProps, 'name' | 'type' | 'value'>, | ||
TextResult { | ||
extends Omit<InputProps, 'name' | 'type' | 'value'> { | ||
name: string | ||
type: 'text' | 'number' | ||
value: string | number | ||
selectedValue: string | ||
} | ||
|
||
export default function BuilderInput(props: BuilderInputProps) { | ||
const { selectedValue, ...nativeProps } = props | ||
return <Input {...nativeProps} type="text" value={selectedValue} /> | ||
return <Input {...nativeProps} value={selectedValue} /> | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use client' | ||
|
||
import CodeBuilder from '@/app/components/code-builder/code-builder' | ||
import { builder } from '@/app/components/code-builder/helpers' | ||
import { useCodeBuilder } from '@/app/context/code-builder' | ||
import { ProgressBar } from '@cerberus-design/react' | ||
|
||
const api = { | ||
size: builder.Enum('size', ['sm', 'md']), | ||
usage: builder.Enum('usage', ['rounded', 'block']), | ||
now: builder.Number('now', 75), | ||
indeterminate: builder.Boolean('indeterminate', false), | ||
} | ||
|
||
export function LivePlayground() { | ||
return ( | ||
<CodeBuilder api={api}> | ||
<ProgressBarPreview /> | ||
</CodeBuilder> | ||
) | ||
} | ||
|
||
export function LivePlaygroundWithCode() { | ||
return ( | ||
<CodeBuilder | ||
api={api} | ||
code={`import { ProgressBar, type ProgressBarProps } from '@cerberus-design/react' | ||
export function MyProgressBar(props: ProgressBarProps) { | ||
return ( | ||
<ProgressBar indeterminate={{indeterminate}} size={{size}} usage={{usage}} now={{now}} /> | ||
) | ||
}`} | ||
> | ||
<ProgressBarPreview /> | ||
</CodeBuilder> | ||
) | ||
} | ||
|
||
export function ProgressBarPreview() { | ||
const { selectedProps } = useCodeBuilder() | ||
return <ProgressBar {...selectedProps} now={selectedProps.now as number} /> | ||
} |
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
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
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
Oops, something went wrong.