@royaloperahouse/chord 0.1.0 → 0.3.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/README.md +9 -0
- package/dist/chord.cjs.development.js +567 -278
- package/dist/chord.cjs.development.js.map +1 -1
- package/dist/chord.cjs.production.min.js +1 -1
- package/dist/chord.cjs.production.min.js.map +1 -1
- package/dist/chord.esm.js +567 -279
- package/dist/chord.esm.js.map +1 -1
- package/dist/components/atoms/Account/Account.d.ts +1 -1
- package/dist/components/atoms/Basket/Basket.d.ts +1 -1
- package/dist/components/atoms/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/atoms/Dropdown/Dropdown.style.d.ts +1 -1
- package/dist/components/atoms/Icons/SvgIcons/index.d.ts +0 -1
- package/dist/components/atoms/Logo/Logo.d.ts +1 -1
- package/dist/components/atoms/Search/Search.d.ts +1 -1
- package/dist/components/atoms/SponsorLogo/SponsorLogo.d.ts +4 -0
- package/dist/components/atoms/SponsorLogo/SponsorLogo.style.d.ts +1 -0
- package/dist/components/atoms/SponsorLogo/index.d.ts +2 -0
- package/dist/components/atoms/Tab/Tab.d.ts +1 -1
- package/dist/components/atoms/index.d.ts +2 -1
- package/dist/components/molecules/NavTop/NavTop.d.ts +1 -1
- package/dist/components/molecules/Tabs/Tabs.d.ts +1 -1
- package/dist/components/molecules/Tabs/Tabs.style.d.ts +1 -1
- package/dist/components/organisms/Navigation/Navigation.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/styles/themes.d.ts +6 -0
- package/dist/types/navigation.d.ts +24 -0
- package/dist/types/types.d.ts +24 -2
- package/package.json +10 -6
- package/dist/components/atoms/Icons/SvgIcons/Logos/Sponsors/Sponsor.svg.d.ts +0 -4
- package/dist/components/atoms/Image/Image.d.ts +0 -38
- package/src/components/atoms/Account/Account.stories.tsx +0 -93
- package/src/components/atoms/Account/Account.test.tsx +0 -54
- package/src/components/atoms/Account/Account.tsx +0 -25
- package/src/components/atoms/Account/index.tsx +0 -3
- package/src/components/atoms/Basket/Basket.stories.tsx +0 -79
- package/src/components/atoms/Basket/Basket.style.tsx +0 -74
- package/src/components/atoms/Basket/Basket.test.tsx +0 -35
- package/src/components/atoms/Basket/Basket.tsx +0 -34
- package/src/components/atoms/Basket/index.tsx +0 -3
- package/src/components/atoms/Buttons/Button.style.tsx +0 -31
- package/src/components/atoms/Buttons/Button.tsx +0 -21
- package/src/components/atoms/Buttons/ButtonIconWrapper.style.tsx +0 -10
- package/src/components/atoms/Buttons/Buttons.stories.tsx +0 -77
- package/src/components/atoms/Buttons/Primary/PrimaryButton.stories.tsx +0 -94
- package/src/components/atoms/Buttons/Primary/PrimaryButton.test.tsx +0 -39
- package/src/components/atoms/Buttons/Primary/PrimaryButton.tsx +0 -14
- package/src/components/atoms/Buttons/Primary/PrimaryButtonWrapper.style.tsx +0 -11
- package/src/components/atoms/Buttons/Secondary/SecondaryButton.stories.tsx +0 -84
- package/src/components/atoms/Buttons/Secondary/SecondaryButton.test.tsx +0 -39
- package/src/components/atoms/Buttons/Secondary/SecondaryButton.tsx +0 -14
- package/src/components/atoms/Buttons/Secondary/SecondaryButtonWrapper.style.tsx +0 -11
- package/src/components/atoms/Buttons/Tertiary/TertiaryButton.stories.tsx +0 -73
- package/src/components/atoms/Buttons/Tertiary/TertiaryButton.style.tsx +0 -29
- package/src/components/atoms/Buttons/Tertiary/TertiaryButton.test.tsx +0 -29
- package/src/components/atoms/Buttons/Tertiary/TertiaryButton.tsx +0 -18
- package/src/components/atoms/Buttons/index.tsx +0 -5
- package/src/components/atoms/Dropdown/Dropdown.stories.tsx +0 -153
- package/src/components/atoms/Dropdown/Dropdown.style.tsx +0 -64
- package/src/components/atoms/Dropdown/Dropdown.test.tsx +0 -67
- package/src/components/atoms/Dropdown/Dropdown.tsx +0 -131
- package/src/components/atoms/Dropdown/index.tsx +0 -3
- package/src/components/atoms/Grid/Grid.stories.tsx +0 -127
- package/src/components/atoms/Grid/Grid.test.tsx +0 -17
- package/src/components/atoms/Grid/Grid.tsx +0 -11
- package/src/components/atoms/Grid/GridItem.test.tsx +0 -25
- package/src/components/atoms/Grid/GridItem.tsx +0 -24
- package/src/components/atoms/Grid/index.tsx +0 -3
- package/src/components/atoms/Heading/Heading.stories.tsx +0 -44
- package/src/components/atoms/Heading/Heading.style.tsx +0 -14
- package/src/components/atoms/Heading/Heading.test.tsx +0 -13
- package/src/components/atoms/Heading/Heading.tsx +0 -15
- package/src/components/atoms/Heading/index.tsx +0 -3
- package/src/components/atoms/Icons/Icons.stories.tsx +0 -190
- package/src/components/atoms/Icons/Icons.style.tsx +0 -24
- package/src/components/atoms/Icons/Icons.test.tsx +0 -31
- package/src/components/atoms/Icons/Icons.tsx +0 -20
- package/src/components/atoms/Icons/StorybookSupport/Iconography.tsx +0 -27
- package/src/components/atoms/Icons/StorybookSupport/IconsDiv.style.tsx +0 -49
- package/src/components/atoms/Icons/SvgIcons/12px/Remove.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/12px/Tick.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Actions/AddToMyList.svg.tsx +0 -13
- package/src/components/atoms/Icons/SvgIcons/Actions/BookTickets.svg.tsx +0 -20
- package/src/components/atoms/Icons/SvgIcons/Actions/ChooseDates.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Actions/EditMyList.svg.tsx +0 -16
- package/src/components/atoms/Icons/SvgIcons/Actions/Filter.svg.tsx +0 -19
- package/src/components/atoms/Icons/SvgIcons/Actions/FindAScreening.svg.tsx +0 -31
- package/src/components/atoms/Icons/SvgIcons/Actions/OnMyList.svg.tsx +0 -16
- package/src/components/atoms/Icons/SvgIcons/Actions/Reminder.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Actions/Subscribe.svg.tsx +0 -9
- package/src/components/atoms/Icons/SvgIcons/Actions/Watch.svg.tsx +0 -9
- package/src/components/atoms/Icons/SvgIcons/Arrows/Arrow.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Arrows/CarouselArrow.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Arrows/DropdownArrow.svg.tsx +0 -8
- package/src/components/atoms/Icons/SvgIcons/Descriptors/Cinema.svg.tsx +0 -31
- package/src/components/atoms/Icons/SvgIcons/Descriptors/Clock.svg.tsx +0 -15
- package/src/components/atoms/Icons/SvgIcons/Descriptors/CreditCard.svg.tsx +0 -19
- package/src/components/atoms/Icons/SvgIcons/Descriptors/Email.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Descriptors/Info.svg.tsx +0 -13
- package/src/components/atoms/Icons/SvgIcons/Descriptors/List.svg.tsx +0 -22
- package/src/components/atoms/Icons/SvgIcons/Descriptors/Location.svg.tsx +0 -15
- package/src/components/atoms/Icons/SvgIcons/Descriptors/PDF.svg.tsx +0 -20
- package/src/components/atoms/Icons/SvgIcons/Descriptors/Phone.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Descriptors/Print.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Descriptors/Secure.svg.tsx +0 -15
- package/src/components/atoms/Icons/SvgIcons/Descriptors/Tickets.svg.tsx +0 -13
- package/src/components/atoms/Icons/SvgIcons/Logos/Social/Facebook.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Logos/Social/Instagram.svg.tsx +0 -19
- package/src/components/atoms/Icons/SvgIcons/Logos/Social/Tiktok.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Logos/Social/Twitter.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Logos/Social/Youtube.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Logos/Sponsors/Sponsor.svg.tsx +0 -26
- package/src/components/atoms/Icons/SvgIcons/Navigation/BalletAndDance.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Navigation/Basket.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Navigation/BasketFull.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Navigation/Home.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Navigation/LiveStream.svg.tsx +0 -24
- package/src/components/atoms/Icons/SvgIcons/Navigation/Menu.svg.tsx +0 -10
- package/src/components/atoms/Icons/SvgIcons/Navigation/OperaAndMusic.svg.tsx +0 -17
- package/src/components/atoms/Icons/SvgIcons/Navigation/Search.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Navigation/Settings.svg.tsx +0 -15
- package/src/components/atoms/Icons/SvgIcons/Navigation/User.svg.tsx +0 -15
- package/src/components/atoms/Icons/SvgIcons/Navigation/UserSignedIn.svg.tsx +0 -12
- package/src/components/atoms/Icons/SvgIcons/Text/Delete.svg.tsx +0 -12
- package/src/components/atoms/Icons/SvgIcons/Text/Shift.svg.tsx +0 -8
- package/src/components/atoms/Icons/SvgIcons/Text/Space.svg.tsx +0 -8
- package/src/components/atoms/Icons/SvgIcons/Utility/Close.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Utility/Confirm.svg.tsx +0 -8
- package/src/components/atoms/Icons/SvgIcons/Utility/Detract.svg.tsx +0 -8
- package/src/components/atoms/Icons/SvgIcons/Utility/Expand.svg.tsx +0 -8
- package/src/components/atoms/Icons/SvgIcons/Utility/ExternalLink.svg.tsx +0 -12
- package/src/components/atoms/Icons/SvgIcons/Utility/GridView.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Utility/ListView.svg.tsx +0 -10
- package/src/components/atoms/Icons/SvgIcons/Utility/Refresh.svg.tsx +0 -15
- package/src/components/atoms/Icons/SvgIcons/Video/AudioDescription.svg.tsx +0 -16
- package/src/components/atoms/Icons/SvgIcons/Video/Back10.svg.tsx +0 -16
- package/src/components/atoms/Icons/SvgIcons/Video/Clips.svg.tsx +0 -10
- package/src/components/atoms/Icons/SvgIcons/Video/Forward10.svg.tsx +0 -16
- package/src/components/atoms/Icons/SvgIcons/Video/FullScreen.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Video/Minimise.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Video/Muted.svg.tsx +0 -15
- package/src/components/atoms/Icons/SvgIcons/Video/Pause.svg.tsx +0 -9
- package/src/components/atoms/Icons/SvgIcons/Video/Play.svg.tsx +0 -9
- package/src/components/atoms/Icons/SvgIcons/Video/Restart.svg.tsx +0 -11
- package/src/components/atoms/Icons/SvgIcons/Video/Subtitles.svg.tsx +0 -17
- package/src/components/atoms/Icons/SvgIcons/Video/Trailer.svg.tsx +0 -12
- package/src/components/atoms/Icons/SvgIcons/Video/Volume.svg.tsx +0 -19
- package/src/components/atoms/Icons/SvgIcons/index.tsx +0 -149
- package/src/components/atoms/Icons/__snapshots__/Icons.test.tsx.snap +0 -1954
- package/src/components/atoms/Icons/index.tsx +0 -2
- package/src/components/atoms/Image/Image.tsx +0 -72
- package/src/components/atoms/ImageAspectRatioWrapper/ImageAspectRatio.test.tsx +0 -23
- package/src/components/atoms/ImageAspectRatioWrapper/ImageAspectRatioWrapper.stories.tsx +0 -71
- package/src/components/atoms/ImageAspectRatioWrapper/ImageAspectRatioWrapper.tsx +0 -15
- package/src/components/atoms/ImageAspectRatioWrapper/index.tsx +0 -3
- package/src/components/atoms/IndividualListing/IndividualListing.stories.tsx +0 -51
- package/src/components/atoms/IndividualListing/IndividualListing.style.tsx +0 -33
- package/src/components/atoms/IndividualListing/IndividualListing.test.tsx +0 -30
- package/src/components/atoms/IndividualListing/IndividualListing.tsx +0 -22
- package/src/components/atoms/IndividualListing/index.tsx +0 -3
- package/src/components/atoms/Logo/Logo.stories.tsx +0 -48
- package/src/components/atoms/Logo/Logo.style.tsx +0 -18
- package/src/components/atoms/Logo/Logo.tsx +0 -30
- package/src/components/atoms/Logo/index.tsx +0 -3
- package/src/components/atoms/Search/Search.stories.tsx +0 -63
- package/src/components/atoms/Search/Search.style.tsx +0 -36
- package/src/components/atoms/Search/Search.test.tsx +0 -24
- package/src/components/atoms/Search/Search.tsx +0 -16
- package/src/components/atoms/Search/index.tsx +0 -3
- package/src/components/atoms/SectionSplitter/SectionSplitter.stories.tsx +0 -47
- package/src/components/atoms/SectionSplitter/SectionSplitter.style.tsx +0 -11
- package/src/components/atoms/SectionSplitter/SectionSplitter.tsx +0 -22
- package/src/components/atoms/SectionSplitter/index.tsx +0 -3
- package/src/components/atoms/Sponsorship/Sponsorship.stories.tsx +0 -38
- package/src/components/atoms/Sponsorship/Sponsorship.test.tsx +0 -36
- package/src/components/atoms/Sponsorship/Sponsorship.tsx +0 -53
- package/src/components/atoms/Sponsorship/index.tsx +0 -3
- package/src/components/atoms/Tab/Tab.stories.tsx +0 -67
- package/src/components/atoms/Tab/Tab.style.tsx +0 -105
- package/src/components/atoms/Tab/Tab.test.tsx +0 -28
- package/src/components/atoms/Tab/Tab.tsx +0 -34
- package/src/components/atoms/Tab/index.tsx +0 -3
- package/src/components/atoms/TextLink/TextLink.stories.tsx +0 -81
- package/src/components/atoms/TextLink/TextLink.style.tsx +0 -26
- package/src/components/atoms/TextLink/TextLink.test.tsx +0 -39
- package/src/components/atoms/TextLink/TextLink.tsx +0 -20
- package/src/components/atoms/TextLink/index.tsx +0 -3
- package/src/components/atoms/TypeTags/TypeTags.stories.tsx +0 -57
- package/src/components/atoms/TypeTags/TypeTags.style.tsx +0 -28
- package/src/components/atoms/TypeTags/TypeTags.test.tsx +0 -21
- package/src/components/atoms/TypeTags/TypeTags.tsx +0 -15
- package/src/components/atoms/TypeTags/index.tsx +0 -3
- package/src/components/atoms/index.tsx +0 -22
- package/src/components/index.tsx +0 -38
- package/src/components/molecules/ContactNewsletter/ContactNewsletter.style.tsx +0 -116
- package/src/components/molecules/ContactNewsletter/ContactNewsletter.test.tsx +0 -85
- package/src/components/molecules/ContactNewsletter/ContactNewsletter.tsx +0 -51
- package/src/components/molecules/ContactNewsletter/index.tsx +0 -3
- package/src/components/molecules/Editorial/Editorial.stories.tsx +0 -78
- package/src/components/molecules/Editorial/Editorial.style.tsx +0 -73
- package/src/components/molecules/Editorial/Editorial.test.tsx +0 -73
- package/src/components/molecules/Editorial/Editorial.tsx +0 -32
- package/src/components/molecules/Editorial/index.tsx +0 -3
- package/src/components/molecules/NavTop/NavTop.stories.tsx +0 -95
- package/src/components/molecules/NavTop/NavTop.style.tsx +0 -14
- package/src/components/molecules/NavTop/NavTop.test.tsx +0 -113
- package/src/components/molecules/NavTop/NavTop.tsx +0 -27
- package/src/components/molecules/NavTop/index.tsx +0 -3
- package/src/components/molecules/PeopleListing/PeopleListing.stories.tsx +0 -185
- package/src/components/molecules/PeopleListing/PeopleListing.style.tsx +0 -8
- package/src/components/molecules/PeopleListing/PeopleListing.test.tsx +0 -24
- package/src/components/molecules/PeopleListing/PeopleListing.tsx +0 -27
- package/src/components/molecules/PeopleListing/index.tsx +0 -3
- package/src/components/molecules/PolicyLinks/PolicyLinks.style.tsx +0 -41
- package/src/components/molecules/PolicyLinks/PolicyLinks.test.tsx +0 -28
- package/src/components/molecules/PolicyLinks/PolicyLinks.tsx +0 -19
- package/src/components/molecules/PolicyLinks/index.tsx +0 -3
- package/src/components/molecules/PromoWithTitle/PromoWithTitle.stories.tsx +0 -119
- package/src/components/molecules/PromoWithTitle/PromoWithTitle.style.tsx +0 -108
- package/src/components/molecules/PromoWithTitle/PromoWithTitle.test.tsx +0 -75
- package/src/components/molecules/PromoWithTitle/PromoWithTitle.tsx +0 -53
- package/src/components/molecules/PromoWithTitle/index.tsx +0 -3
- package/src/components/molecules/SearchBar/SearchBar.stories.tsx +0 -35
- package/src/components/molecules/SearchBar/SearchBar.style.tsx +0 -66
- package/src/components/molecules/SearchBar/SearchBar.test.tsx +0 -63
- package/src/components/molecules/SearchBar/SearchBar.tsx +0 -69
- package/src/components/molecules/SearchBar/index.tsx +0 -3
- package/src/components/molecules/SectionTitle/SectionTitle.stories.tsx +0 -68
- package/src/components/molecules/SectionTitle/SectionTitle.style.tsx +0 -34
- package/src/components/molecules/SectionTitle/SectionTitle.test.tsx +0 -35
- package/src/components/molecules/SectionTitle/SectionTitle.tsx +0 -25
- package/src/components/molecules/SectionTitle/index.tsx +0 -3
- package/src/components/molecules/Tabs/Tabs.stories.tsx +0 -101
- package/src/components/molecules/Tabs/Tabs.style.tsx +0 -74
- package/src/components/molecules/Tabs/Tabs.test.tsx +0 -149
- package/src/components/molecules/Tabs/Tabs.tsx +0 -67
- package/src/components/molecules/Tabs/index.tsx +0 -3
- package/src/components/molecules/TextOnly/TextOnly.stories.tsx +0 -74
- package/src/components/molecules/TextOnly/TextOnly.style.tsx +0 -56
- package/src/components/molecules/TextOnly/TextOnly.test.tsx +0 -79
- package/src/components/molecules/TextOnly/TextOnly.tsx +0 -16
- package/src/components/molecules/TextOnly/index.tsx +0 -3
- package/src/components/molecules/index.tsx +0 -7
- package/src/components/organisms/Footer/Footer.stories.tsx +0 -54
- package/src/components/organisms/Footer/Footer.style.tsx +0 -72
- package/src/components/organisms/Footer/Footer.test.tsx +0 -31
- package/src/components/organisms/Footer/Footer.tsx +0 -53
- package/src/components/organisms/Footer/exampleData.json +0 -78
- package/src/components/organisms/Footer/index.tsx +0 -3
- package/src/components/organisms/Navigation/Navigation.stories.tsx +0 -110
- package/src/components/organisms/Navigation/Navigation.style.tsx +0 -87
- package/src/components/organisms/Navigation/Navigation.test.tsx +0 -115
- package/src/components/organisms/Navigation/Navigation.tsx +0 -109
- package/src/components/organisms/Navigation/index.tsx +0 -3
- package/src/components/organisms/Navigation/menuData.json +0 -104
- package/src/components/organisms/index.tsx +0 -4
- package/src/index.tsx +0 -44
- package/src/jest.setup.ts +0 -1
- package/src/styles/GlobalStyles.tsx +0 -205
- package/src/styles/StorybookSupport/Colours/Colours.stories.mdx +0 -101
- package/src/styles/StorybookSupport/Colours/StorybookColourBox.tsx +0 -32
- package/src/styles/ThemeProvider.tsx +0 -11
- package/src/styles/themes.ts +0 -398
- package/src/styles/viewports.ts +0 -14
- package/src/types/buttonTypes.ts +0 -42
- package/src/types/editorial.ts +0 -84
- package/src/types/footer.ts +0 -49
- package/src/types/iconTypes.ts +0 -38
- package/src/types/image.ts +0 -13
- package/src/types/images.d.ts +0 -1
- package/src/types/index.tsx +0 -5
- package/src/types/navigation.ts +0 -149
- package/src/types/types.ts +0 -276
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { ITertiaryButtonProps } from '../../../../types/buttonTypes';
|
|
3
|
-
|
|
4
|
-
const TertiaryButtonWrapper = styled.a<ITertiaryButtonProps>`
|
|
5
|
-
padding: 0;
|
|
6
|
-
height: var(--button-height);
|
|
7
|
-
font-family: var(--font-family-buttons);
|
|
8
|
-
font-size: var(--button-font-size);
|
|
9
|
-
font-weight: var(--button-font-weight);
|
|
10
|
-
color: var(--base-color-${({ color }) => color});
|
|
11
|
-
width: fit-content;
|
|
12
|
-
background: none;
|
|
13
|
-
border-style: none;
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
cursor: pointer;
|
|
18
|
-
text-decoration: none;
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
const TertiaryIconWrapper = styled.span`
|
|
23
|
-
width: var(--button-icon-width);
|
|
24
|
-
height: var(--button-icon-height);
|
|
25
|
-
margin-left: var(--button-icon-margin);
|
|
26
|
-
display: inline-block;
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export { TertiaryIconWrapper, TertiaryButtonWrapper };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, within, fireEvent } from '@testing-library/react';
|
|
3
|
-
import TertiaryButton from './TertiaryButton';
|
|
4
|
-
|
|
5
|
-
describe('TertiaryButton component', () => {
|
|
6
|
-
const onClick = jest.fn();
|
|
7
|
-
it('renders button with specific text with icon', () => {
|
|
8
|
-
const { getByText } = render(<TertiaryButton onClick={onClick}>Tertiary button text</TertiaryButton>);
|
|
9
|
-
const button = getByText('Tertiary button text');
|
|
10
|
-
expect(button).toBeInTheDocument();
|
|
11
|
-
expect(within(button).getByTestId('tertiary-icon')).toBeInTheDocument();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('truncates button text if its length is greater than 30 characters', () => {
|
|
15
|
-
const { getByText, queryAllByText } = render(
|
|
16
|
-
<TertiaryButton onClick={onClick}>Very Very Long Tertiary button text</TertiaryButton>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
expect(queryAllByText('Very Very Long Tertiary button text')).toHaveLength(0);
|
|
20
|
-
expect(getByText('Very Very Long Tertiary button')).toBeInTheDocument();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('calls onClick callback when button is clicked', () => {
|
|
24
|
-
const { getByText } = render(<TertiaryButton onClick={onClick}>Tertiary button text</TertiaryButton>);
|
|
25
|
-
|
|
26
|
-
fireEvent.click(getByText('Tertiary button text'));
|
|
27
|
-
expect(onClick).toBeCalled();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent } from 'react';
|
|
2
|
-
import { TertiaryButtonWrapper, TertiaryIconWrapper } from './TertiaryButton.style';
|
|
3
|
-
import { Icon } from '../../Icons';
|
|
4
|
-
import { IButtonProps } from '../../../../types/buttonTypes';
|
|
5
|
-
|
|
6
|
-
const Button: FunctionComponent<IButtonProps> = ({ children, color, ...rest }) => {
|
|
7
|
-
const truncatedString = (children as string).substring(0, 30);
|
|
8
|
-
return (
|
|
9
|
-
<TertiaryButtonWrapper {...rest} color={color}>
|
|
10
|
-
{truncatedString}
|
|
11
|
-
<TertiaryIconWrapper data-testid="tertiary-icon">
|
|
12
|
-
<Icon iconName="Arrow" color={color} />
|
|
13
|
-
</TertiaryIconWrapper>
|
|
14
|
-
</TertiaryButtonWrapper>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default Button;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Story, Meta } from '@storybook/react';
|
|
3
|
-
import GlobalStyles from '../../../styles/GlobalStyles';
|
|
4
|
-
import ThemeProvider from '../../../styles/ThemeProvider';
|
|
5
|
-
import Dropdown from './index';
|
|
6
|
-
import { IDropdownProps, ThemeType } from '../../../types/types';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Components/Dropdown',
|
|
10
|
-
component: Dropdown,
|
|
11
|
-
argTypes: {
|
|
12
|
-
ref: {
|
|
13
|
-
table: { disable: true },
|
|
14
|
-
},
|
|
15
|
-
theme: {
|
|
16
|
-
table: { disable: true },
|
|
17
|
-
},
|
|
18
|
-
as: {
|
|
19
|
-
table: { disable: true },
|
|
20
|
-
},
|
|
21
|
-
forwardedAs: {
|
|
22
|
-
table: { disable: true },
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
parameters: {
|
|
26
|
-
docs: {
|
|
27
|
-
description: {
|
|
28
|
-
component: 'Dropdown component',
|
|
29
|
-
withSource: 'none',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
design: {
|
|
33
|
-
type: 'figma',
|
|
34
|
-
url: 'https://www.figma.com/file/PtlqtJAjr87djTyD0x40m9/Royal-Opera-House-UI-Guide-and-Spec?node-id=166%3A0',
|
|
35
|
-
},
|
|
36
|
-
jest: ['Dropdown'],
|
|
37
|
-
},
|
|
38
|
-
decorators: [
|
|
39
|
-
(Story) => (
|
|
40
|
-
<ThemeProvider theme={ThemeType.Core}>
|
|
41
|
-
<GlobalStyles />
|
|
42
|
-
{Story()}
|
|
43
|
-
</ThemeProvider>
|
|
44
|
-
),
|
|
45
|
-
],
|
|
46
|
-
} as Meta;
|
|
47
|
-
|
|
48
|
-
const Template: Story<IDropdownProps> = (args) => <Dropdown {...args} />;
|
|
49
|
-
|
|
50
|
-
export const DropdownWithTextOnly = Template.bind({});
|
|
51
|
-
|
|
52
|
-
DropdownWithTextOnly.args = {
|
|
53
|
-
title: 'TEXT',
|
|
54
|
-
withIcon: 'none',
|
|
55
|
-
selected: false,
|
|
56
|
-
onChange: () => {},
|
|
57
|
-
options: [
|
|
58
|
-
{
|
|
59
|
-
option: 'OPTION 1',
|
|
60
|
-
optionLink: 'link 1',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
option: 'OPTION 2',
|
|
64
|
-
optionLink: 'link 2',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
option: 'OPTION 3',
|
|
68
|
-
optionLink: 'link 3',
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const DropdownWithIconRight = Template.bind({});
|
|
74
|
-
|
|
75
|
-
DropdownWithIconRight.args = {
|
|
76
|
-
iconName: 'DropdownArrow',
|
|
77
|
-
withIcon: 'right',
|
|
78
|
-
title: 'TEXT',
|
|
79
|
-
selected: false,
|
|
80
|
-
onChange: () => {},
|
|
81
|
-
options: [
|
|
82
|
-
{
|
|
83
|
-
option: 'OPTION 1',
|
|
84
|
-
optionLink: 'link 1',
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
option: 'OPTION 2',
|
|
88
|
-
optionLink: 'link 2',
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
option: 'OPTION 3',
|
|
92
|
-
optionLink: 'link 3',
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export const DropdownWithIconLeft = Template.bind({});
|
|
98
|
-
|
|
99
|
-
DropdownWithIconLeft.args = {
|
|
100
|
-
iconName: 'DropdownArrow',
|
|
101
|
-
withIcon: 'left',
|
|
102
|
-
title: 'TEXT',
|
|
103
|
-
selected: false,
|
|
104
|
-
onChange: () => {},
|
|
105
|
-
options: [
|
|
106
|
-
{
|
|
107
|
-
option: 'OPTION 1',
|
|
108
|
-
optionLink: 'link 1',
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
option: 'OPTION 2',
|
|
112
|
-
optionLink: 'link 2',
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
option: 'OPTION 3',
|
|
116
|
-
optionLink: 'link 3',
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export const DropdownWithoutOptions = Template.bind({});
|
|
122
|
-
|
|
123
|
-
DropdownWithoutOptions.args = {
|
|
124
|
-
title: 'TEXT',
|
|
125
|
-
withIcon: 'none',
|
|
126
|
-
selected: false,
|
|
127
|
-
onChange: () => {},
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export const DropdownWithoutOptionsInMobile = Template.bind({});
|
|
131
|
-
|
|
132
|
-
DropdownWithoutOptionsInMobile.args = {
|
|
133
|
-
iconName: 'DropdownArrow',
|
|
134
|
-
withOptionsInMobile: false,
|
|
135
|
-
title: 'TEXT',
|
|
136
|
-
titleLink: 'foo',
|
|
137
|
-
selected: false,
|
|
138
|
-
onChange: () => {},
|
|
139
|
-
options: [
|
|
140
|
-
{
|
|
141
|
-
option: 'OPTION 1',
|
|
142
|
-
optionLink: 'link 1',
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
option: 'OPTION 2',
|
|
146
|
-
optionLink: 'link 2',
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
option: 'OPTION 3',
|
|
150
|
-
optionLink: 'link 3',
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { devices } from '../../../styles/viewports';
|
|
3
|
-
import { IDropdownProps } from '../../../types/types';
|
|
4
|
-
|
|
5
|
-
export const TabContainer = styled.div`
|
|
6
|
-
display: inline-flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
position: relative;
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
export const OptionItem = styled.a`
|
|
12
|
-
font-size: var(--font-size-navigation);
|
|
13
|
-
font-family: var(--font-family-navigation);
|
|
14
|
-
color: var(--base-color-black);
|
|
15
|
-
text-decoration: none;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
text-transform: uppercase;
|
|
18
|
-
|
|
19
|
-
:hover {
|
|
20
|
-
color: var(--base-color-primary);
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
export const OptionsContainer = styled.div<IDropdownProps>`
|
|
25
|
-
background-color: var(--base-color-white);
|
|
26
|
-
border: 1px solid var(--base-color-light-grey);
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
row-gap: var(--navigation-small-gap);
|
|
30
|
-
padding: var(--navigation-middle-gap);
|
|
31
|
-
position: absolute;
|
|
32
|
-
top: 25px;
|
|
33
|
-
width: max-content;
|
|
34
|
-
z-index: 10;
|
|
35
|
-
|
|
36
|
-
${(props) => {
|
|
37
|
-
if (props.withIcon === 'none') {
|
|
38
|
-
return `
|
|
39
|
-
top: 21px;
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
42
|
-
return ``;
|
|
43
|
-
}}
|
|
44
|
-
|
|
45
|
-
@media ${devices.mobileAndTablet} {
|
|
46
|
-
padding-left: 0px;
|
|
47
|
-
padding-bottom: 0px;
|
|
48
|
-
row-gap: var(--navigation-large-gap);
|
|
49
|
-
border: 0;
|
|
50
|
-
background-color: none;
|
|
51
|
-
|
|
52
|
-
${(props) => {
|
|
53
|
-
if (props.withOptionsInMobile) {
|
|
54
|
-
return `
|
|
55
|
-
position: relative;
|
|
56
|
-
top: 0px;
|
|
57
|
-
`;
|
|
58
|
-
}
|
|
59
|
-
return `
|
|
60
|
-
display: none;
|
|
61
|
-
`;
|
|
62
|
-
}}
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
-
import Dropdown from './Dropdown';
|
|
4
|
-
import { IOptionItem } from '../../../types/types';
|
|
5
|
-
|
|
6
|
-
describe('Dropdown component', () => {
|
|
7
|
-
const onClick = jest.fn();
|
|
8
|
-
|
|
9
|
-
it('renders text with specific text', () => {
|
|
10
|
-
const title = 'TAB';
|
|
11
|
-
const options: IOptionItem[] = [
|
|
12
|
-
{
|
|
13
|
-
option: 'foo',
|
|
14
|
-
optionLink: 'bar',
|
|
15
|
-
},
|
|
16
|
-
];
|
|
17
|
-
const onChange = onClick;
|
|
18
|
-
|
|
19
|
-
const { getByText } = render(<Dropdown title={title} options={options} onChange={onChange}></Dropdown>);
|
|
20
|
-
|
|
21
|
-
expect(getByText(title)).toBeInTheDocument();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('calls onClick callback when text is clicked', () => {
|
|
25
|
-
const title = 'TAB';
|
|
26
|
-
const options: IOptionItem[] = [];
|
|
27
|
-
const onChange = onClick;
|
|
28
|
-
|
|
29
|
-
const { getByText } = render(<Dropdown title={title} options={options} onChange={onChange}></Dropdown>);
|
|
30
|
-
fireEvent.click(getByText('TAB'));
|
|
31
|
-
|
|
32
|
-
expect(onClick).toBeCalled();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('renders options when click text', () => {
|
|
36
|
-
const title = 'TAB';
|
|
37
|
-
const options: IOptionItem[] = [
|
|
38
|
-
{
|
|
39
|
-
option: 'foo',
|
|
40
|
-
optionLink: 'bar',
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
const onChange = onClick;
|
|
44
|
-
|
|
45
|
-
const { getByText } = render(<Dropdown title={title} options={options} onChange={onChange}></Dropdown>);
|
|
46
|
-
fireEvent.click(getByText('TAB'));
|
|
47
|
-
|
|
48
|
-
expect(getByText('foo')).toBeInTheDocument();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('calls onClick callback when click text option', () => {
|
|
52
|
-
const title = 'TAB';
|
|
53
|
-
const options: IOptionItem[] = [
|
|
54
|
-
{
|
|
55
|
-
option: 'foo',
|
|
56
|
-
optionLink: 'bar',
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
const onChange = onClick;
|
|
60
|
-
|
|
61
|
-
const { getByText } = render(<Dropdown title={title} options={options} onChange={onChange}></Dropdown>);
|
|
62
|
-
fireEvent.click(getByText('TAB'));
|
|
63
|
-
fireEvent.click(getByText('foo'));
|
|
64
|
-
|
|
65
|
-
expect(onClick).toBeCalled();
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import { TabContainer, OptionsContainer, OptionItem } from './Dropdown.style';
|
|
3
|
-
import { IDropdownProps, INodeProps } from '../../../types/types';
|
|
4
|
-
import Tab from '../Tab';
|
|
5
|
-
|
|
6
|
-
const Dropdown = ({
|
|
7
|
-
title,
|
|
8
|
-
titleLink,
|
|
9
|
-
selected = false,
|
|
10
|
-
options = [],
|
|
11
|
-
onChange,
|
|
12
|
-
iconName = 'DropdownArrow',
|
|
13
|
-
isMobileBehaviour = false,
|
|
14
|
-
withOptionsInMobile = true,
|
|
15
|
-
withIcon = 'right',
|
|
16
|
-
}: IDropdownProps) => {
|
|
17
|
-
const node: INodeProps = useRef();
|
|
18
|
-
const [open, setOpen] = useState(false);
|
|
19
|
-
const [lockOpen, setLockOpen] = useState(false);
|
|
20
|
-
const [titleSelected, setTitleSelected] = useState(selected);
|
|
21
|
-
let timerCloseOptions: number;
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
document.addEventListener('mousedown', handleClick);
|
|
25
|
-
|
|
26
|
-
return () => {
|
|
27
|
-
document.removeEventListener('mousedown', handleClick);
|
|
28
|
-
};
|
|
29
|
-
}, []);
|
|
30
|
-
|
|
31
|
-
const handleClick = (e: any) => {
|
|
32
|
-
if (node.current.contains(e.target)) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (isMobileBehaviour) {
|
|
37
|
-
if (timerCloseOptions) {
|
|
38
|
-
clearTimeout(timerCloseOptions);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
timerCloseOptions = setTimeout(() => {
|
|
42
|
-
setOpen(false);
|
|
43
|
-
setLockOpen(false);
|
|
44
|
-
setTitleSelected(false);
|
|
45
|
-
}, 200);
|
|
46
|
-
} else {
|
|
47
|
-
setOpen(false);
|
|
48
|
-
setLockOpen(false);
|
|
49
|
-
setTitleSelected(false);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const handleChange = (optionLink: string) => {
|
|
54
|
-
if (onChange) {
|
|
55
|
-
onChange(optionLink);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
setOpen(false);
|
|
59
|
-
setLockOpen(false);
|
|
60
|
-
setTitleSelected(false);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const handleClickTitle = (value: string) => {
|
|
64
|
-
if (withOptions()) {
|
|
65
|
-
setLockOpen(true);
|
|
66
|
-
setOpen(true);
|
|
67
|
-
setTitleSelected(titleSelected);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (onChange) {
|
|
71
|
-
onChange(value);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const onMouseHandler = (value: boolean) => {
|
|
76
|
-
if (withOptions() && !lockOpen) {
|
|
77
|
-
setOpen(value);
|
|
78
|
-
setTitleSelected(value);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const clickMobileHandler = () => {
|
|
83
|
-
if (withOptions()) {
|
|
84
|
-
setOpen(!open);
|
|
85
|
-
setTitleSelected(!open);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const renderTab = () => {
|
|
90
|
-
return (
|
|
91
|
-
<>
|
|
92
|
-
<Tab
|
|
93
|
-
title={title}
|
|
94
|
-
titleLink={titleLink}
|
|
95
|
-
selected={titleSelected}
|
|
96
|
-
iconName={iconName}
|
|
97
|
-
withIcon={withIcon}
|
|
98
|
-
withTextInMobile={withOptionsInMobile}
|
|
99
|
-
onClick={(value) => handleClickTitle(value)}
|
|
100
|
-
></Tab>
|
|
101
|
-
{withOptions() && open && (
|
|
102
|
-
<OptionsContainer withOptionsInMobile={withOptionsInMobile} withIcon={withIcon}>
|
|
103
|
-
{options.map((optionItem, index) => (
|
|
104
|
-
<OptionItem key={`key-${index}-${optionItem.option}`} onClick={() => handleChange(optionItem.optionLink)}>
|
|
105
|
-
{optionItem.option}
|
|
106
|
-
</OptionItem>
|
|
107
|
-
))}
|
|
108
|
-
</OptionsContainer>
|
|
109
|
-
)}
|
|
110
|
-
</>
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const withOptions = () => options.length > 0;
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<>
|
|
118
|
-
{isMobileBehaviour ? (
|
|
119
|
-
<TabContainer ref={node} onClick={() => clickMobileHandler()}>
|
|
120
|
-
{renderTab()}
|
|
121
|
-
</TabContainer>
|
|
122
|
-
) : (
|
|
123
|
-
<TabContainer ref={node} onMouseEnter={() => onMouseHandler(true)} onMouseLeave={() => onMouseHandler(false)}>
|
|
124
|
-
{renderTab()}
|
|
125
|
-
</TabContainer>
|
|
126
|
-
)}
|
|
127
|
-
</>
|
|
128
|
-
);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export default Dropdown;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import { Grid, GridItem } from './index';
|
|
4
|
-
import GlobalStyles from '../../../styles/GlobalStyles';
|
|
5
|
-
import ThemeProvider from '../../../styles/ThemeProvider';
|
|
6
|
-
import { ThemeType } from '../../../types/types';
|
|
7
|
-
|
|
8
|
-
const meta: Meta = {
|
|
9
|
-
title: 'Foundations/Grid',
|
|
10
|
-
component: Grid,
|
|
11
|
-
argTypes: {
|
|
12
|
-
items: {
|
|
13
|
-
description:
|
|
14
|
-
'The grid items need a __columnStart__ attribute and can have an optional __columnSpan__ attribute too. The _columnStart_ is the column in which to place it and the _columnSpan_ is the number of columns that the item should span. The default _columnSpan_ is 1.',
|
|
15
|
-
},
|
|
16
|
-
ref: {
|
|
17
|
-
table: { disable: true },
|
|
18
|
-
},
|
|
19
|
-
theme: {
|
|
20
|
-
table: { disable: true },
|
|
21
|
-
},
|
|
22
|
-
as: {
|
|
23
|
-
table: { disable: true },
|
|
24
|
-
},
|
|
25
|
-
forwardedAs: {
|
|
26
|
-
table: { disable: true },
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
decorators: [
|
|
30
|
-
(Story) => (
|
|
31
|
-
<ThemeProvider theme={ThemeType.Core}>
|
|
32
|
-
<GlobalStyles />
|
|
33
|
-
{Story()}
|
|
34
|
-
</ThemeProvider>
|
|
35
|
-
),
|
|
36
|
-
],
|
|
37
|
-
parameters: {
|
|
38
|
-
docs: {
|
|
39
|
-
description: {
|
|
40
|
-
component:
|
|
41
|
-
'To have a full bleed responsive website, a grid is used. All site elements should be designed to this grid so they can be displayed and developed consistently. Using a grid also creates a consistent experience across multiple devices with different screen sizes.',
|
|
42
|
-
withSource: 'none',
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
design: {
|
|
46
|
-
type: 'figma',
|
|
47
|
-
url: 'https://www.figma.com/file/PtlqtJAjr87djTyD0x40m9/ROH:-Design-System-and-Documentation?node-id=3%3A1497',
|
|
48
|
-
},
|
|
49
|
-
jest: ['Grid', 'GridItem'],
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export default meta;
|
|
54
|
-
const Item = () => <div style={{ height: '3rem', backgroundColor: '#C8102E', opacity: '0.2' }} />;
|
|
55
|
-
|
|
56
|
-
interface IStorybookGridItem {
|
|
57
|
-
columnStartDesktop: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16;
|
|
58
|
-
columnSpanDesktop?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16;
|
|
59
|
-
columnStartDevice: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14;
|
|
60
|
-
columnSpanDevice?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface IStorybookGridItemProps {
|
|
64
|
-
items: IStorybookGridItem[];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const GridWithItemsTemplate: Story<IStorybookGridItemProps> = (args) => (
|
|
68
|
-
<Grid>
|
|
69
|
-
{args.items.map((i) => (
|
|
70
|
-
<GridItem
|
|
71
|
-
columnStartDesktop={i.columnStartDesktop}
|
|
72
|
-
columnSpanDesktop={i.columnSpanDesktop}
|
|
73
|
-
columnStartDevice={i.columnStartDevice}
|
|
74
|
-
columnSpanDevice={i.columnSpanDevice}
|
|
75
|
-
key={`key-${Math.random()}`}
|
|
76
|
-
>
|
|
77
|
-
<Item />
|
|
78
|
-
</GridItem>
|
|
79
|
-
))}
|
|
80
|
-
</Grid>
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
export const GridWith12Items = GridWithItemsTemplate.bind({});
|
|
84
|
-
GridWith12Items.args = {
|
|
85
|
-
items: [
|
|
86
|
-
{ columnStartDesktop: 3, columnSpanDesktop: 1, columnStartDevice: 2 },
|
|
87
|
-
{ columnStartDesktop: 4, columnSpanDesktop: 1, columnStartDevice: 3 },
|
|
88
|
-
{ columnStartDesktop: 5, columnSpanDesktop: 1, columnStartDevice: 4 },
|
|
89
|
-
{ columnStartDesktop: 6, columnSpanDesktop: 1, columnStartDevice: 5 },
|
|
90
|
-
{ columnStartDesktop: 7, columnSpanDesktop: 1, columnStartDevice: 6 },
|
|
91
|
-
{ columnStartDesktop: 8, columnSpanDesktop: 1, columnStartDevice: 7 },
|
|
92
|
-
{ columnStartDesktop: 9, columnSpanDesktop: 1, columnStartDevice: 8 },
|
|
93
|
-
{ columnStartDesktop: 10, columnSpanDesktop: 1, columnStartDevice: 9 },
|
|
94
|
-
{ columnStartDesktop: 11, columnSpanDesktop: 1, columnStartDevice: 10 },
|
|
95
|
-
{ columnStartDesktop: 12, columnSpanDesktop: 1, columnStartDevice: 11 },
|
|
96
|
-
{ columnStartDesktop: 13, columnSpanDesktop: 1, columnStartDevice: 12 },
|
|
97
|
-
{ columnStartDesktop: 14, columnSpanDesktop: 1, columnStartDevice: 13 },
|
|
98
|
-
],
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export const GridWithColumnSpan = GridWithItemsTemplate.bind({});
|
|
102
|
-
GridWithColumnSpan.args = {
|
|
103
|
-
items: [
|
|
104
|
-
{ columnStartDesktop: 3, columnSpanDesktop: 4, columnStartDevice: 2, columnSpanDevice: 4 },
|
|
105
|
-
{ columnStartDesktop: 7, columnSpanDesktop: 1, columnStartDevice: 6, columnSpanDevice: 1 },
|
|
106
|
-
{ columnStartDesktop: 8, columnSpanDesktop: 7, columnStartDevice: 7, columnSpanDevice: 7 },
|
|
107
|
-
],
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export const GridWithItemInMargin = GridWithItemsTemplate.bind({});
|
|
111
|
-
GridWithItemInMargin.args = {
|
|
112
|
-
items: [
|
|
113
|
-
{ columnStartDesktop: 2, columnSpanDesktop: 1, columnStartDevice: 2, columnSpanDevice: 2 },
|
|
114
|
-
{ columnStartDesktop: 3, columnSpanDesktop: 4, columnStartDevice: 4, columnSpanDevice: 3 },
|
|
115
|
-
{ columnStartDesktop: 7, columnSpanDesktop: 1, columnStartDevice: 7, columnSpanDevice: 1 },
|
|
116
|
-
{ columnStartDesktop: 8, columnSpanDesktop: 7, columnStartDevice: 8, columnSpanDevice: 6 },
|
|
117
|
-
],
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export const GridWithItemInOuterMargin = GridWithItemsTemplate.bind({});
|
|
121
|
-
GridWithItemInOuterMargin.args = {
|
|
122
|
-
items: [
|
|
123
|
-
{ columnStartDesktop: 1, columnSpanDesktop: 7, columnStartDevice: 1, columnSpanDevice: 8 },
|
|
124
|
-
{ columnStartDesktop: 8, columnSpanDesktop: 4, columnStartDevice: 9, columnSpanDevice: 3 },
|
|
125
|
-
{ columnStartDesktop: 13, columnSpanDesktop: 1, columnStartDevice: 12, columnSpanDevice: 1 },
|
|
126
|
-
],
|
|
127
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import Grid from './Grid';
|
|
4
|
-
|
|
5
|
-
describe('Grid component', () => {
|
|
6
|
-
it('sets proper styles related to a given theme', () => {
|
|
7
|
-
const { getByText } = render(<Grid>grid</Grid>);
|
|
8
|
-
|
|
9
|
-
expect(getByText('grid')).toHaveStyle({
|
|
10
|
-
display: 'grid',
|
|
11
|
-
'grid-template-columns': 'var(--grid-template-columns)',
|
|
12
|
-
'grid-template-rows': 'max-content',
|
|
13
|
-
gap: 'var(--grid-column-gap)',
|
|
14
|
-
margin: '0',
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import GridItem from './GridItem';
|
|
4
|
-
|
|
5
|
-
describe('GridItem component', () => {
|
|
6
|
-
it('sets proper styles when columnSpan is ommited', () => {
|
|
7
|
-
const { getByText } = render(<GridItem columnStartDesktop={2}>gridItem</GridItem>);
|
|
8
|
-
|
|
9
|
-
expect(getByText('gridItem')).toHaveStyle({
|
|
10
|
-
'grid-column': '2 / span 1',
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('sets proper styles when columnSpan is provided', () => {
|
|
15
|
-
const { getByText } = render(
|
|
16
|
-
<GridItem columnStartDesktop={1} columnSpanDesktop={3}>
|
|
17
|
-
gridItem
|
|
18
|
-
</GridItem>
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
expect(getByText('gridItem')).toHaveStyle({
|
|
22
|
-
'grid-column': '1 / span 3',
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|