diff --git a/dashboard/src/components/Filter/Drawer.tsx b/dashboard/src/components/Filter/Drawer.tsx new file mode 100644 index 0000000..ab01492 --- /dev/null +++ b/dashboard/src/components/Filter/Drawer.tsx @@ -0,0 +1,117 @@ +import React from 'react'; +import { FormattedMessage } from 'react-intl'; + +import { IoClose } from 'react-icons/io5'; + +import { Button } from '../ui/button'; + +import { + Drawer as UIDrawer, + DrawerContent, + DrawerFooter, + DrawerClose, + DrawerTrigger, +} from '../ui/drawer'; +import { Separator } from '../ui/separator'; + +interface IDrawerLink { + treeURL: string; + onRefresh: () => void; +} + +interface IFilterDrawer extends IDrawerLink { + children?: React.ReactNode; + onCancel: () => void; + onFilter: () => void; +} + +const DrawerHeader = (): JSX.Element => { + return ( +
+
+ + + + + + +
+ +
+ ); +}; + +const DrawerLink = ({ treeURL, onRefresh }: IDrawerLink): JSX.Element => { + return ( +
+
+ + + + + {treeURL} + +
+ +
+ ); +}; + +const Drawer = ({ + treeURL, + children, + onRefresh, + onCancel, + onFilter, +}: IFilterDrawer): JSX.Element => { + return ( + + + + + + + +
+ +
+ {React.Children.map(children, (child, idx) => ( + <> + {idx != 0 && } +
{child}
+ + ))} +
+
+ + + + + + + + + +
+
+ ); +}; + +export default Drawer; diff --git a/dashboard/src/components/Filter/stories/FilterDrawer.stories.tsx b/dashboard/src/components/Filter/stories/FilterDrawer.stories.tsx new file mode 100644 index 0000000..eafbaf7 --- /dev/null +++ b/dashboard/src/components/Filter/stories/FilterDrawer.stories.tsx @@ -0,0 +1,85 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { fn } from '@storybook/test'; + +import { IntlProvider } from 'react-intl'; +import { flatten } from 'flat'; + +import { LOCALES } from '../../../locales/constants'; + +import { messages } from '../../../locales/messages'; + +import FilterDrawer from '../Drawer'; + +import CheckboxSection from '../CheckboxSection'; +import TimeRangeSection from '../TimeRangeSection'; +import SummarySection from '../SummarySection'; + +const ActionsData = { + onRefresh: fn(), + onCancel: fn(), + onFilter: fn(), +}; + +const meta: Meta = { + title: 'FilterDrawer', + component: FilterDrawer, + parameters: { + layout: 'centered', + }, + tags: ['autodocs'], +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + decorators: [ + (): JSX.Element => ( + + + + + + + + + ), + ], +}; + +const summarySectionProps = { + title: 'Tree', + columns: [ + { title: 'Tree', value: 'stable-rc' }, + { title: 'Matainer', value: 'Shannon Nelson' }, + { + title: 'Commit/tag', + value: '5.15.150-rc1 - 3ab4d9c9e190217ee7e974c70b96795cd2f74611', + }, + ], +}; + +const checkboxSectionProps = { + items: ['linux-5.15.y', 'Status:failed', 'Status: Warnings'], + title: 'Branch', + subtitle: 'Please select one or more Branches', + onClickItem: (idx: number, isChecked: boolean): void => + console.log(idx, isChecked), +}; + +const onChangeM = (e: React.FormEvent): void => + console.log(e.target); +const timeRangeSectionProps = { + title: 'Timing', + subtitle: 'Please select a range of timing:', + min: 0, + max: 100, + onMinChange: onChangeM, + onMaxChange: onChangeM, +}; diff --git a/dashboard/src/locales/messages/index.ts b/dashboard/src/locales/messages/index.ts index 16a7003..da937d9 100644 --- a/dashboard/src/locales/messages/index.ts +++ b/dashboard/src/locales/messages/index.ts @@ -27,6 +27,9 @@ export const messages = { filter: { min: 'Min', max: 'Max', + filtering: 'Filtering', + treeURL: 'Tree URL', + refresh: 'Refresh', }, }, }; diff --git a/dashboard/tailwind.config.js b/dashboard/tailwind.config.js index 6e75cf3..6b935bd 100644 --- a/dashboard/tailwind.config.js +++ b/dashboard/tailwind.config.js @@ -32,14 +32,16 @@ module.exports = { "accordion-up": "accordion-up 0.2s ease-out", }, colors: { - 'bgSecondary' : '#343638', - 'lightBlue': '#11B3E6', + 'bgSecondary': '#343638', + 'lightBlue': '#11B3E6', 'onSecondary-10': '#FFFFFF1A', "white": '#FFFFFF', "lightGray": '#F4F4F4', "mediumGray": '#EAEAEA', "darkGray": '#D6D6D6', + "darkGray2": '#767676', "dimGray": '#454545', + "dimBlack": '#333333', "black": '#000000', "lightRed": '#FFBBBB', "yellow": '#FFD27C',