@hellobetterdigitalnz/betterui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +17 -0
- package/.eslintrc.cjs +14 -0
- package/.storybook/main.ts +23 -0
- package/.storybook/preview.ts +17 -0
- package/README.md +30 -0
- package/index.html +13 -0
- package/package.json +45 -0
- package/public/image/table-image.png +0 -0
- package/public/vite.svg +1 -0
- package/src/App.tsx +30 -0
- package/src/Components/DataDisplay/Accordion/Accordion.stories.tsx +57 -0
- package/src/Components/DataDisplay/Accordion/Accordion.tsx +14 -0
- package/src/Components/DataDisplay/Accordion/AccordionContext.tsx +11 -0
- package/src/Components/DataDisplay/Accordion/AccordionContextInterface.tsx +8 -0
- package/src/Components/DataDisplay/Accordion/AccordionItem.tsx +62 -0
- package/src/Components/DataDisplay/Accordion/AccordionItemProps.tsx +12 -0
- package/src/Components/DataDisplay/Accordion/AccordionProps.tsx +8 -0
- package/src/Components/DataDisplay/Accordion/AccordionProvider.tsx +65 -0
- package/src/Components/DataDisplay/Accordion/AccordionProviderInterface.tsx +8 -0
- package/src/Components/DataDisplay/Accordion/accordion.module.scss +56 -0
- package/src/Components/DataDisplay/Badge/Badge.stories.tsx +44 -0
- package/src/Components/DataDisplay/Badge/Badge.tsx +32 -0
- package/src/Components/DataDisplay/Badge/BadgeProps.tsx +6 -0
- package/src/Components/DataDisplay/Badge/badge.module.scss +42 -0
- package/src/Components/DataDisplay/Cards/BannerCard/BannerCard.stories.tsx +26 -0
- package/src/Components/DataDisplay/Cards/BannerCard/BannerCard.tsx +47 -0
- package/src/Components/DataDisplay/Cards/BannerCard/BannerCardInterface.tsx +15 -0
- package/src/Components/DataDisplay/Cards/BannerCard/banner-card.scss +54 -0
- package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCard.stories.tsx +31 -0
- package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCard.tsx +53 -0
- package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCardInterface.tsx +17 -0
- package/src/Components/DataDisplay/Cards/PathwayCard/pathway-card-stories.scss +3 -0
- package/src/Components/DataDisplay/Cards/PathwayCard/pathway-card.scss +62 -0
- package/src/Components/DataDisplay/Media/Media.tsx +26 -0
- package/src/Components/DataDisplay/Media/MediaProps.tsx +9 -0
- package/src/Components/DataDisplay/Media/media.scss +0 -0
- package/src/Components/DataDisplay/Modal/Modal.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalActions.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalActionsLeft.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalActionsRight.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalBody.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalCurtain.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalHeader.tsx +5 -0
- package/src/Components/DataDisplay/NotificationsBell/NotificationBell.stories.tsx +27 -0
- package/src/Components/DataDisplay/NotificationsBell/NotificationsBell.tsx +51 -0
- package/src/Components/DataDisplay/NotificationsBell/NotificationsBellProps.tsx +9 -0
- package/src/Components/DataDisplay/NotificationsBell/notificationBell.module.scss +48 -0
- package/src/Components/DataDisplay/NotificationsPanel/Notification.stories.tsx +128 -0
- package/src/Components/DataDisplay/NotificationsPanel/Notification.tsx +59 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationProps.tsx +11 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroup.tsx +17 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroupProps.tsx +8 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroups.tsx +42 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroupsProps.tsx +7 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsHeader.tsx +27 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsHeaderProps.tsx +9 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsNone.tsx +11 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsPanel.tsx +8 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsPanelProps.tsx +7 -0
- package/src/Components/DataDisplay/NotificationsPanel/notificationPanel.module.scss +196 -0
- package/src/Components/DataDisplay/Tab/Tab.stories.tsx +72 -0
- package/src/Components/DataDisplay/Tab/Tab.tsx +20 -0
- package/src/Components/DataDisplay/Tab/TabBody.tsx +6 -0
- package/src/Components/DataDisplay/Tab/TabBodyContent.tsx +15 -0
- package/src/Components/DataDisplay/Tab/TabBodyContentProps.tsx +9 -0
- package/src/Components/DataDisplay/Tab/TabBodyProps.tsx +8 -0
- package/src/Components/DataDisplay/Tab/TabContext.tsx +9 -0
- package/src/Components/DataDisplay/Tab/TabContextProps.tsx +6 -0
- package/src/Components/DataDisplay/Tab/TabNav.tsx +6 -0
- package/src/Components/DataDisplay/Tab/TabNavItem.tsx +49 -0
- package/src/Components/DataDisplay/Tab/TabNavItemProps.tsx +9 -0
- package/src/Components/DataDisplay/Tab/TabNavProps.tsx +8 -0
- package/src/Components/DataDisplay/Tab/TabProps.tsx +8 -0
- package/src/Components/DataDisplay/Tab/tab.module.scss +35 -0
- package/src/Components/DataDisplay/Tab/tab.stories.scss +3 -0
- package/src/Components/DataDisplay/Table/Table.stories.tsx +64 -0
- package/src/Components/DataDisplay/Table/Table.tsx +10 -0
- package/src/Components/DataDisplay/Table/TableBody.tsx +13 -0
- package/src/Components/DataDisplay/Table/TableBodyProps.tsx +8 -0
- package/src/Components/DataDisplay/Table/TableCell.tsx +30 -0
- package/src/Components/DataDisplay/Table/TableCellAction.tsx +27 -0
- package/src/Components/DataDisplay/Table/TableCellActionProps.tsx +11 -0
- package/src/Components/DataDisplay/Table/TableCellProps.tsx +11 -0
- package/src/Components/DataDisplay/Table/TableCellWithDesc.tsx +21 -0
- package/src/Components/DataDisplay/Table/TableCellWithDescProps.tsx +9 -0
- package/src/Components/DataDisplay/Table/TableCellWithImage.tsx +39 -0
- package/src/Components/DataDisplay/Table/TableCellWithImageProps.tsx +10 -0
- package/src/Components/DataDisplay/Table/TableFooter.tsx +5 -0
- package/src/Components/DataDisplay/Table/TableHead.tsx +11 -0
- package/src/Components/DataDisplay/Table/TableHeadProps.tsx +8 -0
- package/src/Components/DataDisplay/Table/TableHeaderCell.tsx +17 -0
- package/src/Components/DataDisplay/Table/TableHeaderCellProps.tsx +10 -0
- package/src/Components/DataDisplay/Table/TableProps.tsx +8 -0
- package/src/Components/DataDisplay/Table/TableRow.tsx +9 -0
- package/src/Components/DataDisplay/Table/TableRowProps.tsx +8 -0
- package/src/Components/DataDisplay/Table/table.module.scss +103 -0
- package/src/Components/Form/Button/Button.stories.tsx +66 -0
- package/src/Components/Form/Button/Button.tsx +64 -0
- package/src/Components/Form/Button/ButtonProps.tsx +18 -0
- package/src/Components/Form/Button/button.module.scss +142 -0
- package/src/Components/Form/Checkbox/Checkbox.stories.tsx +49 -0
- package/src/Components/Form/Checkbox/Checkbox.tsx +85 -0
- package/src/Components/Form/Checkbox/CheckboxProps.tsx +22 -0
- package/src/Components/Form/Checkbox/checkbox.module.scss +63 -0
- package/src/Components/Form/CheckboxSelect/CheckboxSelect.tsx +5 -0
- package/src/Components/Form/CheckboxSelect/CheckboxSelectItem.tsx +5 -0
- package/src/Components/Form/CheckboxSet/CheckboxSet.stories.tsx +93 -0
- package/src/Components/Form/CheckboxSet/CheckboxSet.tsx +14 -0
- package/src/Components/Form/CheckboxSet/CheckboxSetItem.tsx +88 -0
- package/src/Components/Form/CheckboxSet/CheckboxSetProps.tsx +9 -0
- package/src/Components/Form/CheckboxSet/checkboxSet.module.scss +13 -0
- package/src/Components/Form/CurrencyField/CurrenctField.stories.tsx +22 -0
- package/src/Components/Form/CurrencyField/CurrencyField.tsx +59 -0
- package/src/Components/Form/CurrencyField/CurrencyFieldProps.tsx +8 -0
- package/src/Components/Form/DateField/DateField.stories.tsx +22 -0
- package/src/Components/Form/DateField/DateField.tsx +58 -0
- package/src/Components/Form/DropdownBadge/DropdownBadge.stories.tsx +49 -0
- package/src/Components/Form/DropdownBadge/DropdownBadge.tsx +160 -0
- package/src/Components/Form/DropdownBadge/DropdownBadgeItem.tsx +40 -0
- package/src/Components/Form/DropdownBadge/DropdownBadgeItemProps.tsx +10 -0
- package/src/Components/Form/DropdownBadge/DropdownBadgeProps.tsx +31 -0
- package/src/Components/Form/DropdownBadge/DropdownBadgeSelector.tsx +11 -0
- package/src/Components/Form/DropdownBadge/DropdownBadgeSelectorProps.tsx +7 -0
- package/src/Components/Form/DropdownBadge/dropdownBadge.module.scss +105 -0
- package/src/Components/Form/DropdownField/DropdownField.stories.tsx +50 -0
- package/src/Components/Form/DropdownField/DropdownField.tsx +118 -0
- package/src/Components/Form/DropdownField/DropdownFieldItem.tsx +26 -0
- package/src/Components/Form/DropdownField/DropdownFieldItemProps.tsx +9 -0
- package/src/Components/Form/DropdownField/DropdownFieldProps.tsx +33 -0
- package/src/Components/Form/DropdownField/DropdownFieldSelector.tsx +15 -0
- package/src/Components/Form/DropdownField/DropdownFieldSelectorProps.tsx +7 -0
- package/src/Components/Form/DropdownField/dropdown.module.scss +79 -0
- package/src/Components/Form/EmailField/EmailField.stories.ts +23 -0
- package/src/Components/Form/EmailField/EmailField.tsx +51 -0
- package/src/Components/Form/ErrorMessage/ErrorMessage.tsx +5 -0
- package/src/Components/Form/FormFieldHolder/FormFieldHolder.tsx +5 -0
- package/src/Components/Form/IconButton/IconButton.stories.tsx +45 -0
- package/src/Components/Form/IconButton/IconButton.tsx +58 -0
- package/src/Components/Form/IconButton/IconButtonProps.tsx +15 -0
- package/src/Components/Form/IconButton/iconButton.module.scss +111 -0
- package/src/Components/Form/InputProps.tsx +25 -0
- package/src/Components/Form/MultiSelectField/MultiSelectField.tsx +5 -0
- package/src/Components/Form/MultiSelectField/MultiSelectFieldItem.tsx +5 -0
- package/src/Components/Form/MultiSelectField/MultiSelectFieldTag.tsx +5 -0
- package/src/Components/Form/PasswordField/PasswordField.stories.tsx +22 -0
- package/src/Components/Form/PasswordField/PasswordField.tsx +70 -0
- package/src/Components/Form/RadioButtons/RadioButton.tsx +70 -0
- package/src/Components/Form/RadioButtons/RadioButtonProps.tsx +22 -0
- package/src/Components/Form/RadioButtons/RadioButtons.stories.tsx +64 -0
- package/src/Components/Form/RadioButtons/RadioButtons.tsx +18 -0
- package/src/Components/Form/RadioButtons/RadioButtonsProps.tsx +10 -0
- package/src/Components/Form/RadioButtons/radioButton.stories.scss +3 -0
- package/src/Components/Form/RadioButtons/radiobutton.module.scss +63 -0
- package/src/Components/Form/TextField/TextField.stories.ts +23 -0
- package/src/Components/Form/TextField/TextField.tsx +52 -0
- package/src/Components/Form/Textarea/Textarea.stories.ts +31 -0
- package/src/Components/Form/Textarea/Textarea.tsx +71 -0
- package/src/Components/Form/Textarea/TextareaProps.tsx +27 -0
- package/src/Components/Form/Textarea/textarea.module.scss +49 -0
- package/src/Components/Form/TimeField/TimeField.stories.tsx +22 -0
- package/src/Components/Form/TimeField/TimeField.tsx +58 -0
- package/src/Components/Form/ToggleSwitch/ToggleSwitch.stories.tsx +49 -0
- package/src/Components/Form/ToggleSwitch/ToggleSwitch.tsx +87 -0
- package/src/Components/Form/ToggleSwitch/ToggleSwitchProps.tsx +22 -0
- package/src/Components/Form/ToggleSwitch/toggleSwitch.module.scss +82 -0
- package/src/Components/Form/inputs.module.scss +121 -0
- package/src/Components/Icons/Arrows/CaretDown/CaretDown.tsx +49 -0
- package/src/Components/Icons/Arrows/CaretUp/CaretUp.tsx +49 -0
- package/src/Components/Icons/Commerce/CurrencyDollarSimple/CurrencyDollarSimple.tsx +105 -0
- package/src/Components/Icons/Communication/AddressBook/AddressBook.stories.ts +28 -0
- package/src/Components/Icons/Communication/AddressBook/AddressBook.tsx +50 -0
- package/src/Components/Icons/Communication/Asterick/Asterisk.stories.ts +28 -0
- package/src/Components/Icons/Communication/Asterick/Asterisk.tsx +50 -0
- package/src/Components/Icons/Communication/AsterickSimple/AsteriskSimple.stories.ts +28 -0
- package/src/Components/Icons/Communication/AsterickSimple/AsteriskSimple.tsx +49 -0
- package/src/Components/Icons/Communication/At/At.stories.ts +28 -0
- package/src/Components/Icons/Communication/At/At.tsx +49 -0
- package/src/Components/Icons/Communication/Broadcast/Broadcast.stories.ts +27 -0
- package/src/Components/Icons/Communication/Broadcast/Broadcast.tsx +49 -0
- package/src/Components/Icons/Communication/Chat/Chat.stories.ts +28 -0
- package/src/Components/Icons/Communication/Chat/Chat.tsx +49 -0
- package/src/Components/Icons/Design/Eye/Eye.tsx +105 -0
- package/src/Components/Icons/Design/EyeSlash/EyeSlash.tsx +105 -0
- package/src/Components/Icons/IconProps.tsx +5 -0
- package/src/Components/Icons/MathAndFinance/XIcon/XIcon.tsx +107 -0
- package/src/Components/Icons/SystemAndDevice/Bell/Bell.tsx +49 -0
- package/src/Components/Icons/Time/CalendarBank/CalendarBank.tsx +105 -0
- package/src/Components/Icons/Time/Clock/Clock.tsx +105 -0
- package/src/Components/Layout/CalloutPopup/CalloutPopup.tsx +5 -0
- package/src/Components/Layout/Header/Header.tsx +5 -0
- package/src/Components/Layout/Header/HeaderLeft.tsx +5 -0
- package/src/Components/Layout/Header/HeaderRight.tsx +5 -0
- package/src/Components/Layout/Pagination/Pagination.tsx +5 -0
- package/src/Components/Layout/Pagination/PaginationFirst.tsx +5 -0
- package/src/Components/Layout/Pagination/PaginationLast.tsx +5 -0
- package/src/Components/Layout/Pagination/PaginationNext.tsx +5 -0
- package/src/Components/Layout/Pagination/PaginationNumber.tsx +5 -0
- package/src/Components/Layout/Pagination/PaginationPrevious.tsx +5 -0
- package/src/Components/Layout/ProfileAvatar/ProfileAvatar.tsx +5 -0
- package/src/Components/Layout/ProfileAvatar/ProfileAvatarProps.tsx +4 -0
- package/src/Components/Layout/ProfileDropdown/ProfileDropdown.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileHeader.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileLink.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileLinks.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileNavigationItem.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileSwitchPanel.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileSwitchUser.tsx +5 -0
- package/src/Components/Layout/Sidebar/Sidebar.tsx +5 -0
- package/src/Components/Layout/Sidebar/SidebarChevron.tsx +5 -0
- package/src/Components/Layout/Sidebar/SidebarNavigation.tsx +5 -0
- package/src/Components/Layout/Sidebar/SidebarNavigationItem.tsx +5 -0
- package/src/Components/Layout/Sidebar/SidebarSubNavigation.tsx +5 -0
- package/src/Notification/Notification.tsx +83 -0
- package/src/Notification/NotificationInterface.tsx +9 -0
- package/src/Notification/NotificationList.tsx +29 -0
- package/src/Notification/NotificationListHolder.tsx +14 -0
- package/src/Notification/NotificationListHolderInterface.tsx +8 -0
- package/src/Notification/NotificationListInterface.tsx +11 -0
- package/src/Notification/notification.scss +225 -0
- package/src/global.scss +231 -0
- package/src/main.tsx +9 -0
- package/src/variables.scss +2 -0
- package/src/vite-env.d.ts +1 -0
- package/tokens/color/color.mdx +82 -0
- package/tokens/shadow/shadow-panel.scss +12 -0
- package/tokens/shadow/shadow.mdx +34 -0
- package/tokens/typography/typography.mdx +31 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +7 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# For more information about the properties used in
|
|
2
|
+
# this file, please see the EditorConfig documentation:
|
|
3
|
+
# http://editorconfig.org/
|
|
4
|
+
|
|
5
|
+
root = true
|
|
6
|
+
|
|
7
|
+
[*]
|
|
8
|
+
charset = utf-8
|
|
9
|
+
end_of_line = lf
|
|
10
|
+
indent_size = 2
|
|
11
|
+
indent_style = space
|
|
12
|
+
insert_final_newline = true
|
|
13
|
+
trim_trailing_whitespace = true
|
|
14
|
+
|
|
15
|
+
[*.md]
|
|
16
|
+
trim_trailing_whitespace = false
|
|
17
|
+
|
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: { browser: true, es2020: true },
|
|
4
|
+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', 'plugin:storybook/recommended'],
|
|
5
|
+
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
|
6
|
+
parser: '@typescript-eslint/parser',
|
|
7
|
+
plugins: ['react-refresh'],
|
|
8
|
+
rules: {
|
|
9
|
+
'react-refresh/only-export-components': [
|
|
10
|
+
'warn',
|
|
11
|
+
{ allowConstantExport: true },
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { StorybookConfig } from "@storybook/react-vite";
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
stories: [
|
|
5
|
+
"../tokens/**/*.mdx",
|
|
6
|
+
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
|
|
7
|
+
],
|
|
8
|
+
addons: [
|
|
9
|
+
"@storybook/addon-links",
|
|
10
|
+
"@storybook/addon-essentials",
|
|
11
|
+
"@storybook/addon-onboarding",
|
|
12
|
+
"@storybook/addon-interactions",
|
|
13
|
+
"@storybook/addon-mdx-gfm"
|
|
14
|
+
],
|
|
15
|
+
framework: {
|
|
16
|
+
name: "@storybook/react-vite",
|
|
17
|
+
options: {},
|
|
18
|
+
},
|
|
19
|
+
docs: {
|
|
20
|
+
autodocs: "tag",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export default config;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Preview } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import '../src/global.scss';
|
|
4
|
+
|
|
5
|
+
const preview: Preview = {
|
|
6
|
+
parameters: {
|
|
7
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
8
|
+
controls: {
|
|
9
|
+
matchers: {
|
|
10
|
+
color: /(background|color)$/i,
|
|
11
|
+
date: /Date$/i,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default preview;
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## Expanding the ESLint configuration
|
|
11
|
+
|
|
12
|
+
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
|
13
|
+
|
|
14
|
+
- Configure the top-level `parserOptions` property like this:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
export default {
|
|
18
|
+
// other rules...
|
|
19
|
+
parserOptions: {
|
|
20
|
+
ecmaVersion: 'latest',
|
|
21
|
+
sourceType: 'module',
|
|
22
|
+
project: ['./tsconfig.json', './tsconfig.node.json'],
|
|
23
|
+
tsconfigRootDir: __dirname,
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
|
|
29
|
+
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
|
|
30
|
+
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + React + TS</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hellobetterdigitalnz/betterui",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc && vite build",
|
|
9
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
10
|
+
"preview": "vite preview",
|
|
11
|
+
"storybook": "storybook dev -p 6006",
|
|
12
|
+
"build-storybook": "storybook build"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@floating-ui/react": "^0.26.4",
|
|
16
|
+
"classnames": "^2.4.0",
|
|
17
|
+
"react": "^18.2.0",
|
|
18
|
+
"react-dom": "^18.2.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@storybook/addon-essentials": "7.6.5",
|
|
22
|
+
"@storybook/addon-interactions": "7.6.5",
|
|
23
|
+
"@storybook/addon-links": "7.6.5",
|
|
24
|
+
"@storybook/addon-mdx-gfm": "7.6.5",
|
|
25
|
+
"@storybook/addon-onboarding": "1.0.10",
|
|
26
|
+
"@storybook/addon-styling-webpack": "0.0.5",
|
|
27
|
+
"@storybook/blocks": "7.6.5",
|
|
28
|
+
"@storybook/react": "7.6.5",
|
|
29
|
+
"@storybook/react-vite": "7.6.5",
|
|
30
|
+
"@storybook/test": "7.6.5",
|
|
31
|
+
"@types/react": "^18.2.37",
|
|
32
|
+
"@types/react-dom": "^18.2.15",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
34
|
+
"@typescript-eslint/parser": "^6.10.0",
|
|
35
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
36
|
+
"eslint": "^8.53.0",
|
|
37
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
38
|
+
"eslint-plugin-react-refresh": "^0.4.4",
|
|
39
|
+
"eslint-plugin-storybook": "^0.6.15",
|
|
40
|
+
"sass": "^1.69.5",
|
|
41
|
+
"storybook": "7.6.5",
|
|
42
|
+
"typescript": "^5.2.2",
|
|
43
|
+
"vite": "^5.0.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
Binary file
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/src/App.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import viteLogo from '/vite.svg'
|
|
3
|
+
|
|
4
|
+
function App() {
|
|
5
|
+
const [count, setCount] = useState(0)
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
<div>
|
|
10
|
+
<a href="https://vitejs.dev" target="_blank">
|
|
11
|
+
<img src={viteLogo} className="logo" alt="Vite logo" />
|
|
12
|
+
</a>
|
|
13
|
+
</div>
|
|
14
|
+
<h1>Vite + React</h1>
|
|
15
|
+
<div className="card">
|
|
16
|
+
<button onClick={() => setCount((count) => count + 1)}>
|
|
17
|
+
count is {count}
|
|
18
|
+
</button>
|
|
19
|
+
<p>
|
|
20
|
+
Edit <code>src/App.tsx</code> and save to test HMR
|
|
21
|
+
</p>
|
|
22
|
+
</div>
|
|
23
|
+
<p className="read-the-docs">
|
|
24
|
+
Click on the Vite and React logos to learn more
|
|
25
|
+
</p>
|
|
26
|
+
</>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default App
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {Meta, StoryObj} from '@storybook/react';
|
|
2
|
+
import Accordion from './Accordion.tsx';
|
|
3
|
+
import AccordionItem from './AccordionItem.tsx';
|
|
4
|
+
|
|
5
|
+
const meta: Meta = {
|
|
6
|
+
title: 'Data Display / Accordion',
|
|
7
|
+
component: Accordion,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
|
|
15
|
+
const AccordionTemplate: Story = {
|
|
16
|
+
render: ({items, ...args}) => {
|
|
17
|
+
return (
|
|
18
|
+
<Accordion {...args}>
|
|
19
|
+
{items.map((item: any) => (
|
|
20
|
+
<AccordionItem index={item.index} title={item.title}>
|
|
21
|
+
{item.children}
|
|
22
|
+
</AccordionItem>
|
|
23
|
+
))}
|
|
24
|
+
</Accordion>
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Example = {
|
|
30
|
+
...AccordionTemplate,
|
|
31
|
+
args: {
|
|
32
|
+
allowMultiple:true,
|
|
33
|
+
items: [
|
|
34
|
+
{
|
|
35
|
+
index:'1',
|
|
36
|
+
title: 'Lorem ipsum dolor',
|
|
37
|
+
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
index:'2',
|
|
41
|
+
title: 'Lorem ipsum dolor',
|
|
42
|
+
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
index:'3',
|
|
46
|
+
title: 'Lorem ipsum dolor',
|
|
47
|
+
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
index:'4',
|
|
51
|
+
title: 'Lorem ipsum dolor',
|
|
52
|
+
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import AccordionProvider from "./AccordionProvider";
|
|
2
|
+
import AccordionProps from "./AccordionProps.tsx";
|
|
3
|
+
|
|
4
|
+
const Accordion = (props: AccordionProps) => {
|
|
5
|
+
const {children, allowMultiple} = props
|
|
6
|
+
|
|
7
|
+
return <AccordionProvider allowMultiple={allowMultiple ? allowMultiple : false}>
|
|
8
|
+
<>
|
|
9
|
+
{children}
|
|
10
|
+
</>
|
|
11
|
+
</AccordionProvider>
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default Accordion;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {createContext} from "react";
|
|
2
|
+
import AccordionContextInterface from "./AccordionContextInterface.tsx";
|
|
3
|
+
|
|
4
|
+
const AccordionContext = createContext<AccordionContextInterface>({
|
|
5
|
+
handleClick: (index: number) => { console.log(`Handling click for index ${index}`); },
|
|
6
|
+
isOpened: (index: number) => { console.log(`Handle index ${index} is opened`); return false; },
|
|
7
|
+
allowMultiple: false,
|
|
8
|
+
openedList: []
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default AccordionContext;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import AccordionContext from "./AccordionContext";
|
|
3
|
+
import AccordionItemProps from "./AccordionItemProps.tsx";
|
|
4
|
+
import styles from './accordion.module.scss';
|
|
5
|
+
import CaretUp from "../../Icons/Arrows/CaretUp/CaretUp";
|
|
6
|
+
import CaretDown from "../../Icons/Arrows/CaretDown/CaretDown";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const AccordionItem = (props: AccordionItemProps) => {
|
|
10
|
+
const {
|
|
11
|
+
index,
|
|
12
|
+
title,
|
|
13
|
+
children,
|
|
14
|
+
onAfterOpened,
|
|
15
|
+
onAfterClosed,
|
|
16
|
+
onBeforeClosed,
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
const itemIndex = typeof index === 'string' ? parseInt(index) : index;
|
|
20
|
+
const context = useContext(AccordionContext);
|
|
21
|
+
|
|
22
|
+
const handleClick = () => {
|
|
23
|
+
if (context.isOpened(itemIndex)) {
|
|
24
|
+
let canClose = true;
|
|
25
|
+
if (onBeforeClosed) {
|
|
26
|
+
canClose = onBeforeClosed();
|
|
27
|
+
}
|
|
28
|
+
if (canClose) {
|
|
29
|
+
context.handleClick(itemIndex);
|
|
30
|
+
}
|
|
31
|
+
if (onAfterClosed) {
|
|
32
|
+
onAfterClosed();
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
context.handleClick(itemIndex);
|
|
36
|
+
if (onAfterOpened) {
|
|
37
|
+
onAfterOpened();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className={styles.accordion}>
|
|
44
|
+
<div onClick={() => handleClick()} className={styles.header}>
|
|
45
|
+
<div className={styles.title}>
|
|
46
|
+
<h4>{title}</h4>
|
|
47
|
+
</div>
|
|
48
|
+
<div className={styles.icon}>
|
|
49
|
+
{context.isOpened(itemIndex) ? <CaretUp /> : <CaretDown />}
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div
|
|
53
|
+
className={`${styles.body} ${
|
|
54
|
+
context.isOpened(itemIndex) ? `${styles.bodyOpened}` : ``
|
|
55
|
+
}`}>
|
|
56
|
+
<div className={`${styles.bodyInner}`}>{children}</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default AccordionItem;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {ReactNode} from "react";
|
|
2
|
+
|
|
3
|
+
interface AccordionItemProps {
|
|
4
|
+
index: string | number;
|
|
5
|
+
title: string;
|
|
6
|
+
children: string | ReactNode;
|
|
7
|
+
onAfterOpened?: () => void;
|
|
8
|
+
onAfterClosed?: () => void;
|
|
9
|
+
onBeforeClosed?: () => boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default AccordionItemProps;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {useState} from "react";
|
|
2
|
+
import AccordionContext from "./AccordionContext";
|
|
3
|
+
import AccordionProviderInterface from "./AccordionProviderInterface.tsx";
|
|
4
|
+
|
|
5
|
+
const AccordionProvider = (props: AccordionProviderInterface) => {
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
children,
|
|
9
|
+
allowMultiple
|
|
10
|
+
} = props;
|
|
11
|
+
|
|
12
|
+
const [openedList, setOpenedList] = useState<any[]>([]);
|
|
13
|
+
|
|
14
|
+
const isOpened = (key: number|string) => {
|
|
15
|
+
return openedList.indexOf(key) >= 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const openItem = (key: number|string) => {
|
|
19
|
+
if (allowMultiple) {
|
|
20
|
+
const list = [...openedList];
|
|
21
|
+
list.push(key);
|
|
22
|
+
setOpenedList(list);
|
|
23
|
+
} else {
|
|
24
|
+
setOpenedList([key])
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const closeItem = (key: number|string) => {
|
|
29
|
+
if (allowMultiple) {
|
|
30
|
+
const list = [...openedList];
|
|
31
|
+
list.splice(list.indexOf(key), 1)
|
|
32
|
+
setOpenedList(list);
|
|
33
|
+
} else {
|
|
34
|
+
setOpenedList([]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const openCloseItem = (key: number|string) => {
|
|
39
|
+
if (allowMultiple) {
|
|
40
|
+
if (isOpened(key)) {
|
|
41
|
+
closeItem(key);
|
|
42
|
+
} else {
|
|
43
|
+
openItem(key)
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
if (!isOpened(key)) {
|
|
47
|
+
openItem(key);
|
|
48
|
+
} else {
|
|
49
|
+
closeItem(key);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return <AccordionContext.Provider value={{
|
|
55
|
+
handleClick: openCloseItem,
|
|
56
|
+
isOpened: isOpened,
|
|
57
|
+
allowMultiple: allowMultiple ? allowMultiple : false,
|
|
58
|
+
openedList: openedList
|
|
59
|
+
}}>
|
|
60
|
+
{children}
|
|
61
|
+
</AccordionContext.Provider>
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default AccordionProvider;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.accordion {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
border-bottom: 1px solid var(--color-gray-300);
|
|
6
|
+
|
|
7
|
+
.header {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
align-items: center;
|
|
11
|
+
min-height: 58px;
|
|
12
|
+
background-color: var(--color-white);
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
border-bottom: 1px solid var(--border);
|
|
15
|
+
padding: var(--spacing-1) var(--spacing-2);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.title {
|
|
19
|
+
h4 {
|
|
20
|
+
font-size: var(--font-size-h4);
|
|
21
|
+
line-height: var(--line-height-h4);
|
|
22
|
+
font-weight: var(--font-weight-h4);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
.icon {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
flex-shrink: 0;
|
|
31
|
+
padding-left: var(--spacing-1);
|
|
32
|
+
|
|
33
|
+
svg{
|
|
34
|
+
width: 24px;
|
|
35
|
+
height: 24px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.body {
|
|
40
|
+
height: 0;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.bodyOpened {
|
|
45
|
+
height: auto;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.bodyInner {
|
|
49
|
+
background: var(--color-white);
|
|
50
|
+
padding: var(--spacing-1\/2) var(--spacing-2) var(--spacing-2) var(--spacing-2);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import Badge from './Badge';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Data Display / Badge',
|
|
8
|
+
component: Badge,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
status: {
|
|
14
|
+
options: ["pending" , "inProgress" , "complete"],
|
|
15
|
+
control: { type: 'select' },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
} satisfies Meta<typeof Badge>;
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
type Story = StoryObj<typeof Badge>;
|
|
23
|
+
|
|
24
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
25
|
+
export const Pending: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
label: 'Pending',
|
|
28
|
+
status:'pending',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const InProgress: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
label: 'In Progress',
|
|
35
|
+
status:'inProgress',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Complete: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
label: 'Complete',
|
|
42
|
+
status:'complete',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import BadgeProps from "./BadgeProps.tsx";
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import styles from './badge.module.scss';
|
|
4
|
+
|
|
5
|
+
const Badge = (props : BadgeProps) => {
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
status,
|
|
9
|
+
label
|
|
10
|
+
} = props;
|
|
11
|
+
|
|
12
|
+
let statusClass = styles.circlePending;
|
|
13
|
+
if (status === 'inProgress') {
|
|
14
|
+
statusClass = styles.circleInProgress;
|
|
15
|
+
} if (status === 'complete') {
|
|
16
|
+
statusClass = styles.circleComplete;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return <div className={styles.badge}>
|
|
20
|
+
<div className={styles.wrapper}>
|
|
21
|
+
{!!label && <div className={cx(
|
|
22
|
+
styles.circle,
|
|
23
|
+
statusClass
|
|
24
|
+
)}></div>}
|
|
25
|
+
<div className={styles.title}>
|
|
26
|
+
<span>{label}</span>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default Badge;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.badge {
|
|
2
|
+
min-height: 24px;
|
|
3
|
+
border-radius: 4px;
|
|
4
|
+
border: 1px solid var(--color-gray-200);
|
|
5
|
+
background: var(--color-lite);
|
|
6
|
+
|
|
7
|
+
.wrapper {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
padding:0 var(--spacing-1\/2) ;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.circle{
|
|
14
|
+
width: 12px;
|
|
15
|
+
height: 12px;
|
|
16
|
+
border-radius: 100%;
|
|
17
|
+
flex-shrink: 1;
|
|
18
|
+
margin-right: 6px;
|
|
19
|
+
|
|
20
|
+
&Pending{
|
|
21
|
+
background: var(--color-gray-300);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&InProgress{
|
|
25
|
+
background: var(--color-inprogress);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&Complete{
|
|
29
|
+
background: var(--color-success);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.title{
|
|
35
|
+
span{
|
|
36
|
+
color: var(--color-gray-900);
|
|
37
|
+
font-size: var(--font-size-body-sm);
|
|
38
|
+
font-weight:var(--font-weight-body-sm) ;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { BannerCard } from './BannerCard.tsx';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Data Display / Card',
|
|
8
|
+
component: BannerCard,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
} satisfies Meta<typeof BannerCard>;
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof BannerCard>;
|
|
14
|
+
|
|
15
|
+
export const Example: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
title:'Lorem ipsum',
|
|
18
|
+
description:'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. ',
|
|
19
|
+
image:'',
|
|
20
|
+
btnTitle:'Button text',
|
|
21
|
+
btnScheme:'primary',
|
|
22
|
+
btnSize:'default',
|
|
23
|
+
btnStyle:'solid',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|