@goodhood-web/ui 0.0.6 → 1.0.0-development.2
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/{src/index.ts → index.d.ts} +1 -24
- package/index.js +48 -0
- package/index.mjs +2341 -0
- package/lib/BaseButton/BaseButton.d.ts +11 -0
- package/lib/Card/Card.d.ts +3 -0
- package/lib/Card/Card.types.d.ts +10 -0
- package/lib/Card/Card.utils.d.ts +3 -0
- package/lib/Card/CardBody/CardBody.d.ts +3 -0
- package/lib/Card/CardBody/CardBody.types.d.ts +5 -0
- package/lib/Card/CardHeader/CardHeader.d.ts +3 -0
- package/lib/Card/CardHeader/CardHeader.type.d.ts +12 -0
- package/lib/ContentCreatorButton/ContentCreatorButton.d.ts +3 -0
- package/{src/lib/ContentCreatorButton/ContentCreatorButton.types.ts → lib/ContentCreatorButton/ContentCreatorButton.types.d.ts} +2 -3
- package/lib/Divider/Divider.d.ts +3 -0
- package/lib/Divider/Divider.types.d.ts +6 -0
- package/lib/Fieldset/Fieldset.d.ts +3 -0
- package/lib/Fieldset/Fieldset.types.d.ts +8 -0
- package/lib/Form/Form.d.ts +3 -0
- package/lib/Form/Form.types.d.ts +10 -0
- package/lib/Icon/Icon.d.ts +4 -0
- package/lib/Icon/Icon.types.d.ts +18 -0
- package/lib/Icon/icons/24x24/index.d.ts +130 -0
- package/lib/Icon/icons/32x32/index.d.ts +265 -0
- package/lib/Icon/icons/index.d.ts +395 -0
- package/lib/IconButton/IconButton.d.ts +3 -0
- package/{src/lib/IconButton/IconButton.types.ts → lib/IconButton/IconButton.types.d.ts} +12 -10
- package/lib/IconButton/utils.d.ts +3 -0
- package/lib/Image/Image.d.ts +3 -0
- package/lib/Image/Image.type.d.ts +5 -0
- package/lib/LabelPill/LabelPill.d.ts +3 -0
- package/lib/LabelPill/LabelPill.types.d.ts +4 -0
- package/lib/Legend/Legend.d.ts +3 -0
- package/lib/Legend/Legend.types.d.ts +5 -0
- package/lib/MenuItem/MenuItem.d.ts +3 -0
- package/lib/MenuItem/MenuItem.types.d.ts +9 -0
- package/lib/NotificationBubble/NotificationBubble.d.ts +3 -0
- package/{src/lib/NotificationBubble/NotificationBubble.types.tsx → lib/NotificationBubble/NotificationBubble.types.d.ts} +2 -3
- package/lib/Thumbnail/Thumbnail.d.ts +3 -0
- package/{src/lib/Thumbnail/Thumbnail.type.tsx → lib/Thumbnail/Thumbnail.type.d.ts} +6 -9
- package/lib/Toggle/Toggle.d.ts +3 -0
- package/{src/lib/Toggle/Toggle.types.ts → lib/Toggle/Toggle.types.d.ts} +2 -3
- package/lib/ToggleInput/ToggleInput.d.ts +3 -0
- package/{src/lib/ToggleInput/ToggleInput.types.ts → lib/ToggleInput/ToggleInput.types.d.ts} +3 -5
- package/lib/Typography/Typography.d.ts +3 -0
- package/lib/Typography/Typography.types.d.ts +8 -0
- package/package.json +3 -2
- package/style.css +1 -0
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -25
- package/.storybook/main.ts +0 -31
- package/.storybook/manager-head.html +0 -1
- package/.storybook/manager.ts +0 -7
- package/.storybook/nebenanTheme.ts +0 -17
- package/.storybook/preview.ts +0 -9
- package/.stylelintrc.json +0 -14
- package/README.md +0 -7
- package/__mocks__/svg.js +0 -2
- package/images/favicon.ico +0 -0
- package/images/logo.svg +0 -11
- package/jest.config.ts +0 -16
- package/project.json +0 -95
- package/release.config.js +0 -30
- package/src/lib/BaseButton/BaseButton.module.scss +0 -11
- package/src/lib/BaseButton/BaseButton.spec.tsx +0 -12
- package/src/lib/BaseButton/BaseButton.stories.tsx +0 -26
- package/src/lib/BaseButton/BaseButton.tsx +0 -39
- package/src/lib/Card/Card.module.scss +0 -15
- package/src/lib/Card/Card.spec.tsx +0 -15
- package/src/lib/Card/Card.stories.tsx +0 -159
- package/src/lib/Card/Card.tsx +0 -31
- package/src/lib/Card/Card.types.ts +0 -12
- package/src/lib/Card/Card.utils.spec.tsx +0 -51
- package/src/lib/Card/Card.utils.ts +0 -23
- package/src/lib/Card/CardBody/CardBody.module.scss +0 -4
- package/src/lib/Card/CardBody/CardBody.spec.tsx +0 -15
- package/src/lib/Card/CardBody/CardBody.stories.tsx +0 -108
- package/src/lib/Card/CardBody/CardBody.tsx +0 -9
- package/src/lib/Card/CardBody/CardBody.types.ts +0 -4
- package/src/lib/Card/CardHeader/CardHeader.module.scss +0 -12
- package/src/lib/Card/CardHeader/CardHeader.spec.tsx +0 -72
- package/src/lib/Card/CardHeader/CardHeader.stories.tsx +0 -77
- package/src/lib/Card/CardHeader/CardHeader.tsx +0 -29
- package/src/lib/Card/CardHeader/CardHeader.type.ts +0 -14
- package/src/lib/ContentCreatorButton/ContentCreatorButton.module.scss +0 -14
- package/src/lib/ContentCreatorButton/ContentCreatorButton.spec.tsx +0 -14
- package/src/lib/ContentCreatorButton/ContentCreatorButton.stories.tsx +0 -29
- package/src/lib/ContentCreatorButton/ContentCreatorButton.tsx +0 -35
- package/src/lib/Divider/Divider.module.scss +0 -10
- package/src/lib/Divider/Divider.spec.tsx +0 -46
- package/src/lib/Divider/Divider.stories.tsx +0 -35
- package/src/lib/Divider/Divider.tsx +0 -17
- package/src/lib/Divider/Divider.types.ts +0 -6
- package/src/lib/Fieldset/Fieldset.module.scss +0 -3
- package/src/lib/Fieldset/Fieldset.spec.tsx +0 -68
- package/src/lib/Fieldset/Fieldset.stories.tsx +0 -60
- package/src/lib/Fieldset/Fieldset.tsx +0 -28
- package/src/lib/Fieldset/Fieldset.types.ts +0 -7
- package/src/lib/Form/Form.spec.tsx +0 -15
- package/src/lib/Form/Form.stories.tsx +0 -53
- package/src/lib/Form/Form.tsx +0 -14
- package/src/lib/Form/Form.types.ts +0 -11
- package/src/lib/Icon/Icon.module.scss +0 -7
- package/src/lib/Icon/Icon.spec.tsx +0 -33
- package/src/lib/Icon/Icon.stories.tsx +0 -88
- package/src/lib/Icon/Icon.tsx +0 -29
- package/src/lib/Icon/Icon.types.ts +0 -23
- package/src/lib/Icon/icons/24x24/index.ts +0 -89
- package/src/lib/Icon/icons/24x24/svg/arrow_left.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/arrow_right.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/bookmark.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/bookmarked.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/burger_menu.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/camera.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/checkmark.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/checkmark_circle.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/chevron_down.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/chevron_left.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/chevron_right.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/chevron_up.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/comment_bubble.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/cross.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/cross_circle.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/envelope.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/event_calendar.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/external_link.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/eye.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/eye_crossed.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/filter.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/globe.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/heart.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/image.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/loudspeaker.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/marketplace.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/more_dots.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/more_dots_alt.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/mute.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/notification_bell.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/paperclip.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/pencil.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/pin.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/plus.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/plus_circle.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/privacy_lock.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/search.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/share_arrow.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/share_arrow_outline.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/sort.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/thanks.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/trash_can.svg +0 -1
- package/src/lib/Icon/icons/32x32/index.ts +0 -179
- package/src/lib/Icon/icons/32x32/svg/address_book.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/baby_toy.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/bicycle.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/bookmark.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/books.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/bubble_heart_filled.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/bubble_heart_outline.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/buildings.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/burger_menu.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/business.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/business_profile.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/camera.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/camera_crossed.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/car.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/carrot.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/chat.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/checkmark_circle.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/christmas_tree.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/clipboard.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/clothing.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/cocktail.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/comment_bubble.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/compass.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/computer.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/couch.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/credit_card.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/cross_circle.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/cutlery.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/drill_tool.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/email.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/envelope.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/event_calendar_check.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/event_calendar_date.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/event_calendar_plus.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/exchange.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/eye.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/eye_crossed.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/gift.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/group.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/healthcare.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/heart.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/house.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/image.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/info.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/invite_neighbour.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/key.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/kitchen_pot.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/list.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/log_out.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/loudspeaker.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/map.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/marketplace.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/miscellaneous_other.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/more_dots.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/more_dots_alt.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/music.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/nebenan.de.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/neighbour.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/notification_bell.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/organisation.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/paper_form_empty.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/paper_form_filled.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/paperclip.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/paw.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/pencil.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/pin.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/pins.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/plant.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/plus.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/plus_circle.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/post.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/privacy_lock.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/qr_code.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/search.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/settings_cog.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/shopping_bag.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/shopping_cart.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/special_place.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/suitcase.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/supporter.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/tennis_ball.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/thanks.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/trash_can.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/truck.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/user.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/user_profile.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/wellness.svg +0 -1
- package/src/lib/Icon/icons/index.ts +0 -9
- package/src/lib/IconButton/IconButton.module.scss +0 -37
- package/src/lib/IconButton/IconButton.spec.tsx +0 -56
- package/src/lib/IconButton/IconButton.stories.tsx +0 -36
- package/src/lib/IconButton/IconButton.tsx +0 -25
- package/src/lib/IconButton/utils.ts +0 -6
- package/src/lib/Image/Image.spec.tsx +0 -10
- package/src/lib/Image/Image.tsx +0 -7
- package/src/lib/Image/Image.type.tsx +0 -5
- package/src/lib/LabelPill/LabelPill.module.scss +0 -33
- package/src/lib/LabelPill/LabelPill.spec.tsx +0 -23
- package/src/lib/LabelPill/LabelPill.stories.tsx +0 -31
- package/src/lib/LabelPill/LabelPill.tsx +0 -16
- package/src/lib/LabelPill/LabelPill.types.ts +0 -4
- package/src/lib/Legend/Legend.module.scss +0 -9
- package/src/lib/Legend/Legend.spec.tsx +0 -35
- package/src/lib/Legend/Legend.stories.ts +0 -39
- package/src/lib/Legend/Legend.tsx +0 -19
- package/src/lib/Legend/Legend.types.ts +0 -5
- package/src/lib/MenuItem/MenuItem.module.scss +0 -73
- package/src/lib/MenuItem/MenuItem.spec.tsx +0 -47
- package/src/lib/MenuItem/MenuItem.stories.tsx +0 -97
- package/src/lib/MenuItem/MenuItem.tsx +0 -34
- package/src/lib/MenuItem/MenuItem.types.ts +0 -10
- package/src/lib/NotificationBubble/NotificationBubble.module.scss +0 -30
- package/src/lib/NotificationBubble/NotificationBubble.spec.tsx +0 -36
- package/src/lib/NotificationBubble/NotificationBubble.stories.tsx +0 -56
- package/src/lib/NotificationBubble/NotificationBubble.tsx +0 -34
- package/src/lib/Thumbnail/Thumbnail.module.scss +0 -68
- package/src/lib/Thumbnail/Thumbnail.spec.tsx +0 -51
- package/src/lib/Thumbnail/Thumbnail.stories.tsx +0 -242
- package/src/lib/Thumbnail/Thumbnail.tsx +0 -28
- package/src/lib/Toggle/Toggle.module.scss +0 -53
- package/src/lib/Toggle/Toggle.spec.tsx +0 -23
- package/src/lib/Toggle/Toggle.stories.tsx +0 -38
- package/src/lib/Toggle/Toggle.tsx +0 -32
- package/src/lib/ToggleInput/ToggleInput.module.scss +0 -32
- package/src/lib/ToggleInput/ToggleInput.spec.tsx +0 -45
- package/src/lib/ToggleInput/ToggleInput.stories.tsx +0 -62
- package/src/lib/ToggleInput/ToggleInput.tsx +0 -40
- package/src/lib/Typography/Typography.module.scss +0 -61
- package/src/lib/Typography/Typography.spec.tsx +0 -60
- package/src/lib/Typography/Typography.stories.tsx +0 -45
- package/src/lib/Typography/Typography.tsx +0 -26
- package/src/lib/Typography/Typography.types.ts +0 -28
- package/src/styles/_design-tokens.scss +0 -1
- package/src/styles/_fonts.scss +0 -0
- package/src/styles/_functions.scss +0 -17
- package/src/styles/_mixins.scss +0 -33
- package/src/styles/index.scss +0 -3
- package/src/styles/reset.scss +0 -67
- package/tsconfig.json +0 -24
- package/tsconfig.lib.json +0 -35
- package/tsconfig.spec.json +0 -20
- package/tsconfig.storybook.json +0 -31
- package/vite.config.ts +0 -57
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { filterAllowedElements, findAllowedElement } from './Card.utils';
|
|
4
|
-
|
|
5
|
-
describe('findAllowedElement', () => {
|
|
6
|
-
it('should find an allowed element among children', () => {
|
|
7
|
-
const children = [<div key="1" />, <React.Fragment key="2" />, <span key="3" />];
|
|
8
|
-
const result = findAllowedElement(children, React.Fragment);
|
|
9
|
-
expect(result).toBeDefined();
|
|
10
|
-
expect((result as React.ReactElement).type).toBe(React.Fragment);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should return undefined if no allowed elements are found', () => {
|
|
14
|
-
const children = [<div key={0} />, <span key={1} />];
|
|
15
|
-
expect(findAllowedElement(children, React.Fragment)).toBeUndefined();
|
|
16
|
-
expect(findAllowedElement(null, React.Fragment)).toBeUndefined();
|
|
17
|
-
expect(findAllowedElement(undefined, React.Fragment)).toBeUndefined();
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('filterAllowedElements', () => {
|
|
22
|
-
let originalEnv: typeof process.env;
|
|
23
|
-
|
|
24
|
-
beforeEach(() => {
|
|
25
|
-
originalEnv = { ...process.env };
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
afterEach(() => {
|
|
29
|
-
process.env = originalEnv; // Restore original environment variables
|
|
30
|
-
jest.restoreAllMocks(); // Restore all mocks
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should filter out disallowed elements', () => {
|
|
34
|
-
const children = [
|
|
35
|
-
<div key="1" />,
|
|
36
|
-
<React.Fragment key="2">Child</React.Fragment>,
|
|
37
|
-
<span key="3" />,
|
|
38
|
-
];
|
|
39
|
-
const allowedElements = [React.Fragment];
|
|
40
|
-
const result = filterAllowedElements(children, allowedElements);
|
|
41
|
-
expect(result.length).toBe(1);
|
|
42
|
-
expect((result[0] as React.ReactElement).type).toBe(React.Fragment);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should return an empty array if no allowed elements are present', () => {
|
|
46
|
-
const children = [<div key={0} />, <span key={1} />];
|
|
47
|
-
const allowedElements = [React.Fragment];
|
|
48
|
-
const result = filterAllowedElements(children, allowedElements);
|
|
49
|
-
expect(result.length).toBe(0);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const isAllowedElement = (
|
|
4
|
-
element: React.ReactNode,
|
|
5
|
-
allowedElementsList: React.ElementType[],
|
|
6
|
-
): boolean =>
|
|
7
|
-
React.isValidElement(element) &&
|
|
8
|
-
typeof element.type !== 'string' &&
|
|
9
|
-
allowedElementsList.includes(element.type);
|
|
10
|
-
|
|
11
|
-
export const findAllowedElement = (
|
|
12
|
-
elements: React.ReactNode,
|
|
13
|
-
type: React.ElementType,
|
|
14
|
-
): React.ReactNode =>
|
|
15
|
-
React.Children.toArray(elements).find((el) => isAllowedElement(el, [type]));
|
|
16
|
-
|
|
17
|
-
export const filterAllowedElements = (
|
|
18
|
-
elements: React.ReactNode,
|
|
19
|
-
allowedElements: React.ElementType[],
|
|
20
|
-
): React.ReactNode[] =>
|
|
21
|
-
React.Children.toArray(elements).filter((el) => {
|
|
22
|
-
return isAllowedElement(el, allowedElements);
|
|
23
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import CardBody from './CardBody';
|
|
5
|
-
|
|
6
|
-
describe('CardBody', () => {
|
|
7
|
-
it('should render successfully', () => {
|
|
8
|
-
const { baseElement } = render(
|
|
9
|
-
<CardBody>
|
|
10
|
-
<p>render successfully</p>
|
|
11
|
-
</CardBody>,
|
|
12
|
-
);
|
|
13
|
-
expect(baseElement).toBeTruthy();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import CardBody from './CardBody';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof CardBody> = {
|
|
6
|
-
component: CardBody,
|
|
7
|
-
title: 'Components/Card/CardBody',
|
|
8
|
-
};
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof CardBody>;
|
|
11
|
-
|
|
12
|
-
const CardBodyComponent = () => {
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
<CardBody>
|
|
16
|
-
<p
|
|
17
|
-
style={{
|
|
18
|
-
color: '#201649',
|
|
19
|
-
fontFamily: 'sans-serif',
|
|
20
|
-
fontSize: '14px',
|
|
21
|
-
marginBottom: '16px',
|
|
22
|
-
}}
|
|
23
|
-
>
|
|
24
|
-
Warum hältst du den Inhalt für problematisch?
|
|
25
|
-
</p>
|
|
26
|
-
<div
|
|
27
|
-
style={{
|
|
28
|
-
border: 'solid 1px #A6A2B6',
|
|
29
|
-
borderRadius: '16px',
|
|
30
|
-
fontFamily: 'sans-serif',
|
|
31
|
-
padding: '16px',
|
|
32
|
-
}}
|
|
33
|
-
>
|
|
34
|
-
<p
|
|
35
|
-
style={{
|
|
36
|
-
color: '#201649',
|
|
37
|
-
fontFamily: 'sans-serif',
|
|
38
|
-
fontSize: '16px',
|
|
39
|
-
fontWeight: 500,
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
Haustiere & Zubehör
|
|
43
|
-
</p>
|
|
44
|
-
</div>
|
|
45
|
-
</CardBody>
|
|
46
|
-
<CardBody>
|
|
47
|
-
<p
|
|
48
|
-
style={{
|
|
49
|
-
color: '#635C80',
|
|
50
|
-
fontFamily: 'sans-serif',
|
|
51
|
-
fontSize: '12px',
|
|
52
|
-
fontWeight: 500,
|
|
53
|
-
lineHeight: '16px',
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
Mit Klick auf "Absenden" bestätigst du, in gutem Glauben davon
|
|
57
|
-
überzeugt zu sein, dass die in der Meldung enthaltenen Angaben und Anführungen
|
|
58
|
-
richtig und vollständig sind.
|
|
59
|
-
</p>
|
|
60
|
-
<p
|
|
61
|
-
style={{
|
|
62
|
-
color: '#635C80',
|
|
63
|
-
fontFamily: 'sans-serif',
|
|
64
|
-
fontSize: '12px',
|
|
65
|
-
fontWeight: 500,
|
|
66
|
-
lineHeight: '16px',
|
|
67
|
-
}}
|
|
68
|
-
>
|
|
69
|
-
Weitere Informationen zum Meldeprozess und Beschwerdegründen in den{' '}
|
|
70
|
-
<span
|
|
71
|
-
style={{
|
|
72
|
-
color: '#01819C',
|
|
73
|
-
fontFamily: 'sans-serif',
|
|
74
|
-
fontWeight: 700,
|
|
75
|
-
}}
|
|
76
|
-
>
|
|
77
|
-
Beitragsrichtlinien
|
|
78
|
-
</span>{' '}
|
|
79
|
-
und zur Verarbeitung personenbezogener Daten in den{' '}
|
|
80
|
-
<span
|
|
81
|
-
style={{
|
|
82
|
-
color: '#01819C',
|
|
83
|
-
fontFamily: 'sans-serif',
|
|
84
|
-
fontWeight: 700,
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
Datenschutzbestimmungen
|
|
88
|
-
</span>
|
|
89
|
-
.
|
|
90
|
-
</p>
|
|
91
|
-
</CardBody>
|
|
92
|
-
</>
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export const Primary: Story = {
|
|
97
|
-
argTypes: {
|
|
98
|
-
children: {
|
|
99
|
-
control: { readonly: true, type: 'string' },
|
|
100
|
-
description: `"children" prop is a versatile way to include various components and content within the CardBody, allowing you to customize and structure the content according to your needs.`,
|
|
101
|
-
},
|
|
102
|
-
className: {
|
|
103
|
-
control: { readonly: true, type: 'string' },
|
|
104
|
-
description: `"className" prop used to assign one or more CSS class names to the HTML element.`,
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
render: () => CardBodyComponent(),
|
|
108
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
|
|
3
|
-
import styles from './CardBody.module.scss';
|
|
4
|
-
import { CardBodyProps } from './CardBody.types';
|
|
5
|
-
|
|
6
|
-
const CardBody = ({ children, className }: CardBodyProps) => (
|
|
7
|
-
<div className={clsx(styles.root, className)}>{children}</div>
|
|
8
|
-
);
|
|
9
|
-
export default CardBody;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { BaseButton, Icon } from '@goodhood-web/ui';
|
|
5
|
-
|
|
6
|
-
import CardHeader from './CardHeader';
|
|
7
|
-
|
|
8
|
-
describe('CardHeader', () => {
|
|
9
|
-
it('renders headline with default heading type', () => {
|
|
10
|
-
render(<CardHeader headline="Test Headline" />);
|
|
11
|
-
const heading = screen.getByRole('heading', { name: 'Test Headline' });
|
|
12
|
-
expect(heading).toBeInTheDocument();
|
|
13
|
-
expect(heading.tagName).toBe('H3');
|
|
14
|
-
expect(heading).toHaveTextContent('Test Headline');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('renders left and right elements when provided', () => {
|
|
18
|
-
const leftElement = <Icon name="arrow_left" size="24" />;
|
|
19
|
-
const rightElement = (
|
|
20
|
-
<BaseButton
|
|
21
|
-
onClick={() => {
|
|
22
|
-
console.log('Right button clicked');
|
|
23
|
-
}}
|
|
24
|
-
>
|
|
25
|
-
Right Button
|
|
26
|
-
</BaseButton>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
render(
|
|
30
|
-
<CardHeader
|
|
31
|
-
headline="Test Headline"
|
|
32
|
-
leftElement={leftElement}
|
|
33
|
-
rightElement={rightElement}
|
|
34
|
-
/>,
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
expect(screen.getByRole('presentation')).toBeInTheDocument();
|
|
38
|
-
expect(screen.getByRole('button', { name: 'Right Button' })).toBeInTheDocument();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('does not render left or right elements if they are not allowed', () => {
|
|
42
|
-
const leftElement = <div>Unallowed Element</div>;
|
|
43
|
-
const rightElement = <span>Another Unallowed Element</span>;
|
|
44
|
-
|
|
45
|
-
render(
|
|
46
|
-
<CardHeader
|
|
47
|
-
headline="Test Headline"
|
|
48
|
-
leftElement={leftElement}
|
|
49
|
-
rightElement={rightElement}
|
|
50
|
-
/>,
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
expect(screen.queryByText('Unallowed Element')).not.toBeInTheDocument();
|
|
54
|
-
expect(screen.queryByText('Another Unallowed Element')).not.toBeInTheDocument();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('does not render elements that are not specified as allowed', () => {
|
|
58
|
-
const leftElement = <div data-testid="unallowed-left">Unallowed Left</div>;
|
|
59
|
-
const rightElement = <div data-testid="unallowed-right">Unallowed Right</div>;
|
|
60
|
-
|
|
61
|
-
render(
|
|
62
|
-
<CardHeader
|
|
63
|
-
headline="No Unallowed Elements"
|
|
64
|
-
leftElement={leftElement}
|
|
65
|
-
rightElement={rightElement}
|
|
66
|
-
/>,
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
expect(screen.queryByTestId('unallowed-left')).not.toBeInTheDocument();
|
|
70
|
-
expect(screen.queryByTestId('unallowed-right')).not.toBeInTheDocument();
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { BaseButton, Icon } from '@goodhood-web/ui';
|
|
4
|
-
|
|
5
|
-
import CardHeader from './CardHeader';
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof CardHeader> = {
|
|
8
|
-
component: CardHeader,
|
|
9
|
-
title: 'Components/Card/CardHeader',
|
|
10
|
-
};
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof CardHeader>;
|
|
13
|
-
|
|
14
|
-
const typesOptions = [
|
|
15
|
-
'h2',
|
|
16
|
-
'h3',
|
|
17
|
-
'h4',
|
|
18
|
-
'h5',
|
|
19
|
-
'h6',
|
|
20
|
-
'h7',
|
|
21
|
-
'h8',
|
|
22
|
-
'body-large',
|
|
23
|
-
'body-regular',
|
|
24
|
-
'body-semibold',
|
|
25
|
-
'body-italic',
|
|
26
|
-
'detail-medium',
|
|
27
|
-
'detail-bold',
|
|
28
|
-
'detail-upper-case',
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const asOptions = ['h2', 'h3', 'h4', 'h5', 'h6', 'h7', 'h8'];
|
|
32
|
-
|
|
33
|
-
export const Primary: Story = {
|
|
34
|
-
argTypes: {
|
|
35
|
-
as: {
|
|
36
|
-
control: { type: 'select' },
|
|
37
|
-
defaultValue: { summary: 'h3' },
|
|
38
|
-
description: `'headerAs': An optional prop to specify the HTML tag (element) to be used for the header. If not provided, it defaults to the 'h3' specified in the type prop.`,
|
|
39
|
-
options: asOptions,
|
|
40
|
-
},
|
|
41
|
-
headline: {
|
|
42
|
-
defaultValue: { summary: '""' },
|
|
43
|
-
description: `'headline': This is the main text content of the header.`,
|
|
44
|
-
},
|
|
45
|
-
leftElement: {
|
|
46
|
-
control: { readonly: true, type: 'string' },
|
|
47
|
-
defaultValue: { summary: 'undefined' },
|
|
48
|
-
description: `'leftElement': prop in the CardHeader component can accept components, such as Icon and IconButton.`,
|
|
49
|
-
},
|
|
50
|
-
rightElement: {
|
|
51
|
-
control: { readonly: true, type: 'string' },
|
|
52
|
-
defaultValue: { summary: 'undefined' },
|
|
53
|
-
description: `'rightElement' props in the CardHeader component can accept components, such as Button.`,
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
type: {
|
|
57
|
-
control: { type: 'select' },
|
|
58
|
-
defaultValue: { summary: 'h3' },
|
|
59
|
-
description: `'type': A string that specifies the type of the headline (default is 'h3').`,
|
|
60
|
-
options: typesOptions,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
args: {
|
|
64
|
-
as: 'h3',
|
|
65
|
-
headline: 'Headline',
|
|
66
|
-
leftElement: <Icon name="chevron_left" size="24" />,
|
|
67
|
-
rightElement: <BaseButton onClick={() => console.log('clicked')}>Action</BaseButton>,
|
|
68
|
-
type: 'h2',
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
parameters: {
|
|
72
|
-
design: {
|
|
73
|
-
type: 'figma',
|
|
74
|
-
url: 'https://www.figma.com/file/hN7xJ3rRAemUJT9T0uEfUS/Product-Design-System?node-id=6105%3A12944&mode=dev',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { BaseButton, Icon, Typography } from '@goodhood-web/ui';
|
|
2
|
-
|
|
3
|
-
import { filterAllowedElements } from '../Card.utils';
|
|
4
|
-
|
|
5
|
-
import styles from './CardHeader.module.scss';
|
|
6
|
-
import { CardHeaderProps } from './CardHeader.type';
|
|
7
|
-
|
|
8
|
-
const CardHeader = ({
|
|
9
|
-
as,
|
|
10
|
-
headline,
|
|
11
|
-
leftElement,
|
|
12
|
-
rightElement,
|
|
13
|
-
type = 'h3',
|
|
14
|
-
}: CardHeaderProps) => {
|
|
15
|
-
const currentLeftElement = filterAllowedElements(leftElement, [Icon, BaseButton]);
|
|
16
|
-
const currentRightElement = filterAllowedElements(rightElement, [BaseButton]);
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<header className={styles.root}>
|
|
20
|
-
{currentLeftElement && currentLeftElement}
|
|
21
|
-
<Typography type={type} as={as} className={styles.title}>
|
|
22
|
-
{headline}
|
|
23
|
-
</Typography>
|
|
24
|
-
{currentRightElement && currentRightElement}
|
|
25
|
-
</header>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default CardHeader;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { BaseButton, Icon } from '@goodhood-web/ui';
|
|
4
|
-
|
|
5
|
-
import { TypographyProps } from '../../Typography/Typography.types';
|
|
6
|
-
|
|
7
|
-
export type CardHeaderProps = {
|
|
8
|
-
as?: Exclude<TypographyProps['as'], 'h1' | 'p' | 'span'>;
|
|
9
|
-
headline: string;
|
|
10
|
-
// TODO Update to IconButton when it's ready
|
|
11
|
-
leftElement?: ReactElement<ComponentProps<typeof Icon | typeof BaseButton>>;
|
|
12
|
-
rightElement?: ReactElement<ComponentProps<typeof BaseButton>>;
|
|
13
|
-
type?: Exclude<TypographyProps['type'], 'h1'>;
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
.ccBtn {
|
|
2
|
-
display: flex;
|
|
3
|
-
width: 100%;
|
|
4
|
-
height: 40px;
|
|
5
|
-
align-items: center;
|
|
6
|
-
align-self: stretch;
|
|
7
|
-
padding: getSpacing('sm') getSpacing('lg');
|
|
8
|
-
border-color: transparent;
|
|
9
|
-
border-radius: mapGet($tokens, borderRadius, md);
|
|
10
|
-
background-color: getSemanticColor('surface', 'surfaceContainer');
|
|
11
|
-
color: getSemanticColor('surface', 'onSurface');
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
font-size: 14px;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
|
-
|
|
3
|
-
import ContentCreatorButton from './ContentCreatorButton';
|
|
4
|
-
|
|
5
|
-
describe('ContentCreatorButton', () => {
|
|
6
|
-
it('should render successfully', () => {
|
|
7
|
-
const { baseElement } = render(
|
|
8
|
-
<ContentCreatorButton onClick={() => console.log('clicked')}>
|
|
9
|
-
Render successfully
|
|
10
|
-
</ContentCreatorButton>,
|
|
11
|
-
);
|
|
12
|
-
expect(baseElement).toBeTruthy();
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import ContentCreatorButton from './ContentCreatorButton';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof ContentCreatorButton> = {
|
|
6
|
-
argTypes: {
|
|
7
|
-
children: {
|
|
8
|
-
control: 'text',
|
|
9
|
-
description: 'Text on the button',
|
|
10
|
-
},
|
|
11
|
-
onClick: { action: 'clicked', description: 'On click event callback' },
|
|
12
|
-
},
|
|
13
|
-
component: ContentCreatorButton,
|
|
14
|
-
title: 'Components/ContentCreatorButton',
|
|
15
|
-
};
|
|
16
|
-
export default meta;
|
|
17
|
-
type Story = StoryObj<typeof ContentCreatorButton>;
|
|
18
|
-
|
|
19
|
-
export const Primary: Story = {
|
|
20
|
-
args: {
|
|
21
|
-
children: 'Neuen Beitrag erstellen',
|
|
22
|
-
},
|
|
23
|
-
parameters: {
|
|
24
|
-
design: {
|
|
25
|
-
type: 'figma',
|
|
26
|
-
url: 'https://www.figma.com/file/hN7xJ3rRAemUJT9T0uEfUS/Product-Design-System?node-id=397%3A6149',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useButton } from '@mui/base';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
|
|
4
|
-
import BaseButton from '../BaseButton/BaseButton';
|
|
5
|
-
import Typography from '../Typography/Typography';
|
|
6
|
-
|
|
7
|
-
import styles from './ContentCreatorButton.module.scss';
|
|
8
|
-
import { ContentCreatorButtonProps } from './ContentCreatorButton.types';
|
|
9
|
-
|
|
10
|
-
const ContentCreatorButton = ({
|
|
11
|
-
children,
|
|
12
|
-
onClick,
|
|
13
|
-
...baseButtonProps
|
|
14
|
-
}: ContentCreatorButtonProps) => {
|
|
15
|
-
const { active, focusVisible } = useButton();
|
|
16
|
-
|
|
17
|
-
const classes = {
|
|
18
|
-
[styles['ccBtn--active']]: active,
|
|
19
|
-
[styles['ccBtn--focusVisible']]: focusVisible,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<BaseButton
|
|
24
|
-
{...baseButtonProps}
|
|
25
|
-
className={clsx(styles.ccBtn, classes)}
|
|
26
|
-
onClick={onClick}
|
|
27
|
-
>
|
|
28
|
-
<Typography type="body-regular" as="span">
|
|
29
|
-
{children}
|
|
30
|
-
</Typography>
|
|
31
|
-
</BaseButton>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default ContentCreatorButton;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
2
|
-
|
|
3
|
-
import Divider from './Divider';
|
|
4
|
-
|
|
5
|
-
describe('Divider', () => {
|
|
6
|
-
it('should render with default full width', () => {
|
|
7
|
-
const { container } = render(<Divider />);
|
|
8
|
-
|
|
9
|
-
const dividerLine = container.querySelector('.dividerLine');
|
|
10
|
-
|
|
11
|
-
expect(dividerLine).not.toBeNull();
|
|
12
|
-
expect(dividerLine?.getAttribute('style')).toBe(
|
|
13
|
-
'margin-left: 0px; margin-right: 0px;',
|
|
14
|
-
);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('should render with 8 offset on the left', () => {
|
|
18
|
-
const { container } = render(<Divider offsetLeft={8} />);
|
|
19
|
-
|
|
20
|
-
const dividerLine = container.querySelector('.dividerLine');
|
|
21
|
-
|
|
22
|
-
expect(dividerLine).not.toBeNull();
|
|
23
|
-
expect(dividerLine?.getAttribute('style')).toBe(
|
|
24
|
-
'margin-left: 8px; margin-right: 0px;',
|
|
25
|
-
);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should render with 16 offset on the right', () => {
|
|
29
|
-
const { container } = render(<Divider offsetRight={16} />);
|
|
30
|
-
|
|
31
|
-
const dividerLine = container.querySelector('.dividerLine');
|
|
32
|
-
|
|
33
|
-
expect(dividerLine).not.toBeNull();
|
|
34
|
-
expect(dividerLine?.getAttribute('style')).toBe(
|
|
35
|
-
'margin-left: 0px; margin-right: 16px;',
|
|
36
|
-
);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should render with role "separator"', () => {
|
|
40
|
-
render(<Divider />);
|
|
41
|
-
|
|
42
|
-
const divider = screen.getByRole('separator');
|
|
43
|
-
|
|
44
|
-
expect(divider).toBeVisible();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import Divider from './Divider';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Divider> = {
|
|
6
|
-
argTypes: {
|
|
7
|
-
offsetLeft: {
|
|
8
|
-
control: { type: 'select' },
|
|
9
|
-
options: [0, 8, 16],
|
|
10
|
-
},
|
|
11
|
-
offsetRight: {
|
|
12
|
-
control: { type: 'select' },
|
|
13
|
-
options: [0, 8, 16],
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
component: Divider,
|
|
17
|
-
title: 'Components/Divider',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default meta;
|
|
21
|
-
|
|
22
|
-
type Story = StoryObj<typeof Divider>;
|
|
23
|
-
|
|
24
|
-
export const Primary: Story = {
|
|
25
|
-
args: {
|
|
26
|
-
offsetLeft: 0,
|
|
27
|
-
offsetRight: 0,
|
|
28
|
-
},
|
|
29
|
-
parameters: {
|
|
30
|
-
design: {
|
|
31
|
-
type: 'figma',
|
|
32
|
-
url: 'https://www.figma.com/file/hN7xJ3rRAemUJT9T0uEfUS/Product-Design-System?node-id=231%3A3089&mode=dev',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import styles from './Divider.module.scss';
|
|
2
|
-
import { DividerProps } from './Divider.types';
|
|
3
|
-
|
|
4
|
-
const Divider = ({ offsetLeft = 0, offsetRight = 0 }: DividerProps) => (
|
|
5
|
-
<div className={styles.dividerContainer}>
|
|
6
|
-
<div
|
|
7
|
-
className={styles.dividerLine}
|
|
8
|
-
style={{
|
|
9
|
-
marginLeft: `${offsetLeft}px`,
|
|
10
|
-
marginRight: `${offsetRight}px`,
|
|
11
|
-
}}
|
|
12
|
-
role="separator"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
export default Divider;
|