Cleaning up storybook files (#5290)
* storybook v2 init * Merge config into storybook vite build * Remove path * Storybook config tweaks * Added styles and settings for storybook v2, and started working on button documentation and examples. * Badges + flex wrap on mobile * Breadcrumbs+button+avatar * Checkbox * Input + moving files around * WIP table * WIP table grid * Replaced imports for new components. * Added first steps for varianttable. * Small alignment fix. * Custom Args Table - With scrollbar * Adding table to components that need it + darkmode * Add intro * Fix types * Remove V1 storybook and replace with V2 * Fix badge type error * Fixed storybook dependencies * Added cover image to storybook * Remove vita from ts config, we dont use vite. * Fixed button import. * Explained postcss pseudo plugin. * Fixed badge import. * Add Avatar Stories * ButtonGroup Stories * Fixed imports * Add checkbox stories * Add exports for differnt types of inputs * Fix form and text area input * Fix mass import errors Co-authored-by: Jeroen Reumkens <[email protected]> Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
234 files changed
+2709
-2692
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import React from "react";
|
||||
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
|
||||
type Props = { children: React.ReactNode; combined?: boolean; containerProps?: JSX.IntrinsicElements["div"] };
|
||||
|
||||
/**
|
||||
* Breakdown of Tailwind Magic below
|
||||
* [&_button]:border-l-0 [&_a]:border-l-0 -> Selects all buttons/a tags and applies a border left of 0
|
||||
* [&>*:first-child]:rounded-l-md [&>*:first-child]:border-l -> Selects the first child of the content
|
||||
* ounds the left side
|
||||
* [&>*:last-child]:rounded-r-md -> Selects the last child of the content and rounds the right side
|
||||
* We dont need to add border to the right as we never remove it
|
||||
*/
|
||||
|
||||
export function ButtonGroup({ children, combined = false, containerProps }: Props) {
|
||||
return (
|
||||
<div
|
||||
{...containerProps}
|
||||
className={classNames(
|
||||
"flex",
|
||||
!combined
|
||||
? "space-x-2"
|
||||
: "[&_button]:rounded-none [&_button]:border-l-0 [&>*:first-child]:rounded-l-md [&>*:first-child]:border-l [&_a]:rounded-none [&_a]:border-l-0 [&>*:last-child]:rounded-r-md",
|
||||
containerProps?.className
|
||||
)}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
||||
import { Examples, Example, Note, Title,CustomArgsTable,VariantsTable,VariantsRow } from '@calcom/storybook/components'
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
|
||||
import { ButtonGroup} from './ButtonGroup';
|
||||
import { Button} from '../button/Button';
|
||||
|
||||
<Meta title="UI/Button Group" component={ButtonGroup} />
|
||||
|
||||
<Title title="Button Group" suffix="Brief" subtitle="Version 2.0 — Last Update: 22 Aug 2022"/>
|
||||
|
||||
## Definition
|
||||
Button group enables multiple buttons to be combined into a single unit. It offers users access to frequently performed, related actions.
|
||||
|
||||
## Structure
|
||||
|
||||
<CustomArgsTable of={ButtonGroup} />
|
||||
|
||||
|
||||
<Examples title="Breadcrumb style"
|
||||
footNote ={
|
||||
<ul>
|
||||
<li>
|
||||
Seperated: In general, seperated button group style can be included in container such as card, modal, and page.
|
||||
</li>
|
||||
<li>
|
||||
Combined: Combined button group can be used standalone e.g. mini toggles for calendars
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
>
|
||||
<Example title="Default" >
|
||||
<ButtonGroup>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" color="secondary" />
|
||||
</ButtonGroup>
|
||||
</Example>
|
||||
<Example title="Combined">
|
||||
<ButtonGroup combined>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" color="secondary" />
|
||||
</ButtonGroup>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
name="All Variatns">
|
||||
<VariantsTable titles={["Default",'Secondary',"Minimal"]} columnMinWidth={150}>
|
||||
<VariantRow variant="Default">
|
||||
<ButtonGroup>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon"/>
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" />
|
||||
</ButtonGroup>
|
||||
<ButtonGroup>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" color="secondary" />
|
||||
</ButtonGroup>
|
||||
<ButtonGroup>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" color="minimal" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" color="minimal" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" color="minimal" />
|
||||
</ButtonGroup>
|
||||
</VariantRow>
|
||||
<VariantRow variant="Combined">
|
||||
<ButtonGroup combined>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" />
|
||||
</ButtonGroup>
|
||||
<ButtonGroup combined>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" color="secondary" />
|
||||
</ButtonGroup>
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./ButtonGroup";
|
||||
Reference in new issue
Block a user