-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
402b4c2
commit 8a49657
Showing
33 changed files
with
347 additions
and
124 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
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,60 @@ | ||
import { AnimatePresence } from 'framer-motion'; | ||
import { produce } from 'immer'; | ||
import { create } from 'zustand'; | ||
|
||
import { isNonEmptyString } from '@busymango/is-esm'; | ||
|
||
import { | ||
IControlWrap, | ||
IDirective, | ||
IFlex, | ||
ISignLine, | ||
ITextArea, | ||
} from '@/components'; | ||
|
||
type DirectiveStore = { | ||
directive?: string; | ||
mutation(recipe: (state: DirectiveStore) => void): void; | ||
}; | ||
|
||
const useDirectiveStore = create<DirectiveStore>((set) => ({ | ||
mutation: (recipe) => { | ||
set(produce(recipe)); | ||
}, | ||
})); | ||
|
||
const App: React.FC = () => { | ||
const { directive, mutation } = useDirectiveStore(); | ||
|
||
return ( | ||
<IFlex vertical gap={16}> | ||
<IControlWrap | ||
suffix={<ISignLine type="cross" />} | ||
variant="bordered" | ||
onSuffixClick={() => { | ||
mutation((state) => { | ||
state.directive = ''; | ||
}); | ||
}} | ||
> | ||
<ITextArea | ||
value={directive} | ||
onChange={({ target }) => { | ||
mutation((state) => { | ||
state.directive = target.value; | ||
}); | ||
}} | ||
/> | ||
</IControlWrap> | ||
<AnimatePresence> | ||
{isNonEmptyString(directive) && ( | ||
<IDirective icon={<ISignLine ring type="informer" />} title="通用"> | ||
{directive} | ||
</IDirective> | ||
)} | ||
</AnimatePresence> | ||
</IFlex> | ||
); | ||
}; | ||
|
||
export default App; |
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,18 +1,45 @@ | ||
import { Fragment } from 'react/jsx-runtime'; | ||
import { VariantControl } from '@examples/widgets'; | ||
|
||
import { ISignLine } from '@/components'; | ||
import { IDirective } from '@/components/widgets/directive'; | ||
import { IDirective, IFlex, ISignLine } from '@/components'; | ||
|
||
const App: React.FC = () => ( | ||
<Fragment> | ||
<IDirective | ||
icon={<ISignLine ring type="informer" />} | ||
title="通用" | ||
></IDirective> | ||
<IDirective icon={<ISignLine ring type="tick" />} title="成功"></IDirective> | ||
<IDirective title="失败"></IDirective> | ||
<IDirective title="警告"></IDirective> | ||
</Fragment> | ||
<VariantControl variants={['filled', 'borderered'] as const}> | ||
{({ variant }) => ( | ||
<IFlex vertical gap={16}> | ||
<IDirective | ||
icon={<ISignLine ring type="informer" />} | ||
title="通用" | ||
variant={variant} | ||
> | ||
这是一个指示。 | ||
</IDirective> | ||
<IDirective | ||
icon={<ISignLine ring type="tick" />} | ||
status="success" | ||
title="成功" | ||
variant={variant} | ||
> | ||
这是一个成功的指示。 | ||
</IDirective> | ||
<IDirective | ||
icon={<ISignLine ring type="cross" />} | ||
status="danger" | ||
title="危险" | ||
variant={variant} | ||
> | ||
这是一个危险的指示。 | ||
</IDirective> | ||
<IDirective | ||
icon={<ISignLine trigon type="informer" />} | ||
status="warn" | ||
title="警告" | ||
variant={variant} | ||
> | ||
这是一个包含警告意的指示。 | ||
</IDirective> | ||
</IFlex> | ||
)} | ||
</VariantControl> | ||
); | ||
|
||
export default App; |
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.