feat: added controls for tooltip & topbanner stories

This commit is contained in:
Jaideep 2023-06-21 11:13:21 +05:30
parent 74d5bffaaf
commit 806137ecbe
No known key found for this signature in database
GPG Key ID: 3E5EBE94B429CDE7
2 changed files with 67 additions and 4 deletions

View File

@ -15,21 +15,46 @@ Tooltip components can be used to provide additional information about an elemen
<Canvas> <Canvas>
<Story name="Tooltip"> <Story name="Tooltip"
args={{
alertMsg: 'Copied!',
hoverMsg: "Copy to clipboard",
content: 'Hover Me',
}}
argTypes={{
alertMsg: {
control: {
type: 'text',
},
},
hoverMsg: {
control: {
type: 'text',
},
},
content: {
control: {
type: 'text',
},
},
}}
>
{({ alertMsg, hoverMsg, content }) => (
<TooltipProvider> <TooltipProvider>
<VariantsTable titles={['']} columnMinWidth={150}> <VariantsTable titles={['']} columnMinWidth={150}>
<VariantRow variant="Default"> <VariantRow variant="Default">
<Tooltip content="Copy to clipboard"> <Tooltip content={`${hoverMsg}`}>
<span <span
className="dark:text-darkgray-50 p-2 bg-brand-default rounded-md text-gray-100 dark:bg-darkgray-900 hover:cursor-pointer" className="dark:text-darkgray-50 p-2 bg-brand-default rounded-md text-gray-100 dark:bg-darkgray-900 hover:cursor-pointer"
onClick={() => { onClick={() => {
alert('Copied!'); alert(`${alertMsg}`);
}}> }}>
Hover Me {content}
</span> </span>
</Tooltip> </Tooltip>
</VariantRow> </VariantRow>
</VariantsTable> </VariantsTable>
</TooltipProvider> </TooltipProvider>
)}
</Story> </Story>
</Canvas> </Canvas>

View File

@ -62,3 +62,41 @@ Each toast has a state to represent neutral, positive or negative responses.
/> />
</Example> </Example>
</Examples> </Examples>
<Canvas>
<Story name="TopBanner"
args={{
text: 'Something big is happening we want you to know about.',
variant: 'default'
}}
argTypes={{
variant: {
control: {
type: 'select',
options: ['default', 'warning', 'error'],
},
},
text: {
control: {
type: 'text',
},
},
}}>
{({ text, variant, ...args }) => (
<TopBanner
{...args}
actions={
<button
className="border-b border-black text-sm"
onClick={() => {
alert("test");
}}>
Action
</button>
}
variant={variant}
text={text}
/>
)}
</Story>
</Canvas>