@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,74 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { IBasketProps } from '../../../types/navigation';
|
|
3
|
-
import { devices } from '../../../styles/viewports';
|
|
4
|
-
|
|
5
|
-
export const BasketContainer = styled.div<IBasketProps>`
|
|
6
|
-
display: inline-flex;
|
|
7
|
-
flex-direction: row;
|
|
8
|
-
justify-content: flex-start;
|
|
9
|
-
align-items: center;
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
border-bottom: 1px solid var(--base-color-transparent);
|
|
12
|
-
|
|
13
|
-
${(props) => {
|
|
14
|
-
if (props.selected) {
|
|
15
|
-
return `
|
|
16
|
-
border-bottom: 1px solid var(--base-color-primary);
|
|
17
|
-
&& a {
|
|
18
|
-
color: var(--base-color-primary);
|
|
19
|
-
}
|
|
20
|
-
&& svg path {
|
|
21
|
-
fill: var(--base-color-primary);
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
}
|
|
25
|
-
return '';
|
|
26
|
-
}}
|
|
27
|
-
|
|
28
|
-
:hover {
|
|
29
|
-
border-bottom: 1px solid var(--base-color-primary);
|
|
30
|
-
&& a {
|
|
31
|
-
color: var(--base-color-primary);
|
|
32
|
-
}
|
|
33
|
-
&& svg path {
|
|
34
|
-
fill: var(--base-color-primary);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
|
-
export const SvgContainer = styled.div`
|
|
40
|
-
position: relative;
|
|
41
|
-
|
|
42
|
-
svg {
|
|
43
|
-
width: var(--navigation-large-gap);
|
|
44
|
-
height: var(--navigation-large-gap);
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
export const NumContainer = styled.div`
|
|
49
|
-
display: flex;
|
|
50
|
-
justify-content: center;
|
|
51
|
-
width: 12px;
|
|
52
|
-
height: 12px;
|
|
53
|
-
position: absolute;
|
|
54
|
-
top: 8px;
|
|
55
|
-
margin-left: 6px;
|
|
56
|
-
|
|
57
|
-
& .basket-num {
|
|
58
|
-
color: white;
|
|
59
|
-
font-size: 10px;
|
|
60
|
-
font-family: var(--font-family-navigation);
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
export const BasketText = styled.a`
|
|
65
|
-
font-size: var(--font-size-navigation);
|
|
66
|
-
font-family: var(--font-family-navigation);
|
|
67
|
-
color: var(--base-color-black);
|
|
68
|
-
margin-left: 6px;
|
|
69
|
-
text-decoration: none;
|
|
70
|
-
|
|
71
|
-
@media ${devices.mobile} {
|
|
72
|
-
display: none;
|
|
73
|
-
}
|
|
74
|
-
`;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
-
import Basket from './Basket';
|
|
4
|
-
import '@testing-library/jest-dom';
|
|
5
|
-
|
|
6
|
-
describe('Basket component', () => {
|
|
7
|
-
const onClickHandler = jest.fn();
|
|
8
|
-
|
|
9
|
-
it('renders text with specific text', () => {
|
|
10
|
-
const text = '29 MINS';
|
|
11
|
-
const selected = false;
|
|
12
|
-
const numItems = 5;
|
|
13
|
-
|
|
14
|
-
const { getByText } = render(
|
|
15
|
-
<Basket text={text} selected={selected} onClick={onClickHandler} numItems={numItems}></Basket>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
expect(getByText(text)).toBeInTheDocument();
|
|
19
|
-
expect(getByText(numItems)).toBeInTheDocument();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('calls onLink callback when basket is clicked', () => {
|
|
23
|
-
const text = '29 MINS';
|
|
24
|
-
const selected = false;
|
|
25
|
-
const numItems = 5;
|
|
26
|
-
|
|
27
|
-
const { getByText } = render(
|
|
28
|
-
<Basket text={text} selected={selected} onClick={onClickHandler} numItems={numItems}></Basket>
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
fireEvent.click(getByText('29 MINS'));
|
|
32
|
-
|
|
33
|
-
expect(onClickHandler).toBeCalled();
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BasketContainer, SvgContainer, NumContainer, BasketText } from './Basket.style';
|
|
3
|
-
import { IBasketProps } from '../../../types/navigation';
|
|
4
|
-
import { Icon } from '../Icons';
|
|
5
|
-
|
|
6
|
-
const Basket = ({ text, selected = false, numItems = 0, onClick }: IBasketProps) => {
|
|
7
|
-
const onClickHandler = () => {
|
|
8
|
-
if (onClick) {
|
|
9
|
-
onClick('/basket');
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const empty = numItems <= 0;
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<BasketContainer selected={selected} onClick={onClickHandler}>
|
|
17
|
-
<SvgContainer>
|
|
18
|
-
{empty ? (
|
|
19
|
-
<Icon iconName="Basket" />
|
|
20
|
-
) : (
|
|
21
|
-
<>
|
|
22
|
-
<Icon iconName="BasketFull" />
|
|
23
|
-
<NumContainer>
|
|
24
|
-
<span className={`basket-num`}>{numItems}</span>
|
|
25
|
-
</NumContainer>
|
|
26
|
-
</>
|
|
27
|
-
)}
|
|
28
|
-
</SvgContainer>
|
|
29
|
-
<div>{!empty ? <BasketText data-testid="baskettext">{text}</BasketText> : ''}</div>
|
|
30
|
-
</BasketContainer>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default Basket;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { IButtonProps } from '../../../types/buttonTypes';
|
|
3
|
-
import { devices } from '../../../styles/viewports';
|
|
4
|
-
|
|
5
|
-
const ButtonWrapper = styled.a<IButtonProps>`
|
|
6
|
-
padding: ${({ iconName }) => (iconName ? 'var(--button-padding-y-icon)' : 'var(--button-padding-y)')}
|
|
7
|
-
var(--button-padding-x);
|
|
8
|
-
height: var(--button-height);
|
|
9
|
-
font-family: var(--font-family-buttons);
|
|
10
|
-
font-size: var(--button-font-size);
|
|
11
|
-
font-weight: var(--button-font-weight);
|
|
12
|
-
color: var(--base-color-${({ color }) => color});
|
|
13
|
-
line-height: var(--button-line-height);
|
|
14
|
-
width: fit-content;
|
|
15
|
-
border-style: solid;
|
|
16
|
-
border-width: 1px;
|
|
17
|
-
cursor: pointer;
|
|
18
|
-
text-decoration: none;
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
box-sizing: border-box;
|
|
23
|
-
|
|
24
|
-
@media ${devices.mobile} {
|
|
25
|
-
& {
|
|
26
|
-
width: 100%;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
export default ButtonWrapper;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent } from 'react';
|
|
2
|
-
import ButtonWrapper from './Button.style';
|
|
3
|
-
import ButtonIconWrapper from './ButtonIconWrapper.style';
|
|
4
|
-
import { Icon } from '../Icons';
|
|
5
|
-
import { IButtonProps } from '../../../types/buttonTypes';
|
|
6
|
-
|
|
7
|
-
const Button: FunctionComponent<IButtonProps> = ({ children, iconName, iconDirection, color, ...rest }) => {
|
|
8
|
-
const truncatedString = (children as string).substring(0, 30);
|
|
9
|
-
return (
|
|
10
|
-
<ButtonWrapper {...rest} color={color} iconName={iconName}>
|
|
11
|
-
{iconName ? (
|
|
12
|
-
<ButtonIconWrapper data-testid="button-icon">
|
|
13
|
-
<Icon iconName={iconName} direction={iconDirection} color={color} />
|
|
14
|
-
</ButtonIconWrapper>
|
|
15
|
-
) : null}
|
|
16
|
-
{truncatedString}
|
|
17
|
-
</ButtonWrapper>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default Button;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
const ButtonIconWrapper = styled.span`
|
|
4
|
-
width: var(--button-icon-width);
|
|
5
|
-
height: var(--button-icon-height);
|
|
6
|
-
margin-right: var(--button-icon-margin);
|
|
7
|
-
display: inline-block;
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
export default ButtonIconWrapper;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React, { MouseEventHandler } from 'react';
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import { PrimaryButton, SecondaryButton, TertiaryButton } from './';
|
|
4
|
-
import GlobalStyles from '../../../styles/GlobalStyles';
|
|
5
|
-
import ThemeProvider from '../../../styles/ThemeProvider';
|
|
6
|
-
import { ThemeType, Colors } from '../../../types/types';
|
|
7
|
-
import { IconNameType } from '../../../types/iconTypes';
|
|
8
|
-
|
|
9
|
-
const meta: Meta = {
|
|
10
|
-
title: 'Components/Foundations/Buttons/All',
|
|
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
|
-
decorators: [
|
|
26
|
-
(Story) => (
|
|
27
|
-
<ThemeProvider theme={ThemeType.Core}>
|
|
28
|
-
<GlobalStyles />
|
|
29
|
-
{Story()}
|
|
30
|
-
</ThemeProvider>
|
|
31
|
-
),
|
|
32
|
-
],
|
|
33
|
-
parameters: {
|
|
34
|
-
docs: {
|
|
35
|
-
description: {
|
|
36
|
-
component: 'All buttons',
|
|
37
|
-
withSource: 'none',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
design: {
|
|
41
|
-
type: 'figma',
|
|
42
|
-
url: 'https://www.figma.com/file/PtlqtJAjr87djTyD0x40m9/ROH:-Design-System-and-Documentation?node-id=3%3A1497',
|
|
43
|
-
},
|
|
44
|
-
jest: ['PrimaryButton', 'SecondaryButton', 'TertiaryButton'],
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default meta;
|
|
49
|
-
|
|
50
|
-
interface IStorybookTertiaryButtonProps {
|
|
51
|
-
text: string;
|
|
52
|
-
color?: Colors;
|
|
53
|
-
bgColor?: Colors;
|
|
54
|
-
iconName?: IconNameType;
|
|
55
|
-
onClick: MouseEventHandler<any>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const ButtonsTemplate: Story<IStorybookTertiaryButtonProps> = (args) => (
|
|
59
|
-
<div style={{ display: 'flex', gap: '10px' }}>
|
|
60
|
-
<PrimaryButton {...args}>{args.text}</PrimaryButton>
|
|
61
|
-
<SecondaryButton {...args}>{args.text}</SecondaryButton>
|
|
62
|
-
<TertiaryButton {...args}>{args.text}</TertiaryButton>
|
|
63
|
-
</div>
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
export const ButtonsWithIcon = ButtonsTemplate.bind({});
|
|
67
|
-
ButtonsWithIcon.args = {
|
|
68
|
-
onClick: () => console.log('click!'),
|
|
69
|
-
text: 'Button Text',
|
|
70
|
-
iconName: 'Arrow',
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const ButtonsWithNoIcon = ButtonsTemplate.bind({});
|
|
74
|
-
ButtonsWithNoIcon.args = {
|
|
75
|
-
onClick: () => console.log('click!'),
|
|
76
|
-
text: 'Button Text',
|
|
77
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React, { MouseEventHandler } from 'react';
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import PrimaryButton from './PrimaryButton';
|
|
4
|
-
import GlobalStyles from '../../../../styles/GlobalStyles';
|
|
5
|
-
import ThemeProvider from '../../../../styles/ThemeProvider';
|
|
6
|
-
import { ThemeType, Colors } from '../../../../types/types';
|
|
7
|
-
import { DirectionType, IconNameType } from '../../../../types/iconTypes';
|
|
8
|
-
|
|
9
|
-
const meta: Meta = {
|
|
10
|
-
title: 'Components/Foundations/Buttons/Primary',
|
|
11
|
-
component: PrimaryButton,
|
|
12
|
-
argTypes: {
|
|
13
|
-
color: {
|
|
14
|
-
description: 'Text and icon color',
|
|
15
|
-
},
|
|
16
|
-
bgColor: {
|
|
17
|
-
description: 'Background color',
|
|
18
|
-
},
|
|
19
|
-
iconName: {
|
|
20
|
-
description: 'Name of the icon to be displayed',
|
|
21
|
-
},
|
|
22
|
-
iconDirection: {
|
|
23
|
-
description: 'Direction of the icon to be displayed',
|
|
24
|
-
},
|
|
25
|
-
ref: {
|
|
26
|
-
table: { disable: true },
|
|
27
|
-
},
|
|
28
|
-
theme: {
|
|
29
|
-
table: { disable: true },
|
|
30
|
-
},
|
|
31
|
-
as: {
|
|
32
|
-
table: { disable: true },
|
|
33
|
-
},
|
|
34
|
-
forwardedAs: {
|
|
35
|
-
table: { disable: true },
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
decorators: [
|
|
39
|
-
(Story) => (
|
|
40
|
-
<ThemeProvider theme={ThemeType.Core}>
|
|
41
|
-
<GlobalStyles />
|
|
42
|
-
{Story()}
|
|
43
|
-
</ThemeProvider>
|
|
44
|
-
),
|
|
45
|
-
],
|
|
46
|
-
parameters: {
|
|
47
|
-
docs: {
|
|
48
|
-
description: {
|
|
49
|
-
component: 'Primary button',
|
|
50
|
-
withSource: 'none',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
design: {
|
|
54
|
-
type: 'figma',
|
|
55
|
-
url: 'https://www.figma.com/file/PtlqtJAjr87djTyD0x40m9/ROH:-Design-System-and-Documentation?node-id=3%3A1497',
|
|
56
|
-
},
|
|
57
|
-
jest: ['PrimaryButton'],
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export default meta;
|
|
62
|
-
|
|
63
|
-
interface IStorybookPrimaryButtonProps {
|
|
64
|
-
text: string;
|
|
65
|
-
color?: Colors;
|
|
66
|
-
bgColor?: Colors;
|
|
67
|
-
iconName?: IconNameType;
|
|
68
|
-
iconDirection?: DirectionType;
|
|
69
|
-
onClick: MouseEventHandler<any>;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const PrimaryButtonTemplate: Story<IStorybookPrimaryButtonProps> = (args) => (
|
|
73
|
-
<PrimaryButton {...args}>{args.text}</PrimaryButton>
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
export const ButtonWithNoIcon = PrimaryButtonTemplate.bind({});
|
|
77
|
-
ButtonWithNoIcon.args = {
|
|
78
|
-
onClick: () => console.log('click!'),
|
|
79
|
-
text: 'Button Text',
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const ButtonWithIcon = PrimaryButtonTemplate.bind({});
|
|
83
|
-
ButtonWithIcon.args = {
|
|
84
|
-
onClick: () => console.log('click!'),
|
|
85
|
-
iconName: 'BookTickets',
|
|
86
|
-
text: 'Button Text',
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const ButtonWithLongText = PrimaryButtonTemplate.bind({});
|
|
90
|
-
ButtonWithLongText.args = {
|
|
91
|
-
onClick: () => console.log('click!'),
|
|
92
|
-
iconName: 'BookTickets',
|
|
93
|
-
text: 'Very Very Long Button Truncated Text',
|
|
94
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, within, fireEvent } from '@testing-library/react';
|
|
3
|
-
import PrimaryButton from './PrimaryButton';
|
|
4
|
-
|
|
5
|
-
describe('PrimaryButton component', () => {
|
|
6
|
-
const onClick = jest.fn();
|
|
7
|
-
it('renders button with specific text', () => {
|
|
8
|
-
const { getByText } = render(<PrimaryButton onClick={onClick}>Primary button text</PrimaryButton>);
|
|
9
|
-
|
|
10
|
-
expect(getByText('Primary button text')).toBeInTheDocument();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('truncates button text if its length is greater than 30 characters', () => {
|
|
14
|
-
const { getByText, queryAllByText } = render(
|
|
15
|
-
<PrimaryButton onClick={onClick}>Very Very Long Primary button text</PrimaryButton>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
expect(queryAllByText('Very Very Long Primary button text')).toHaveLength(0);
|
|
19
|
-
expect(getByText('Very Very Long Primary button')).toBeInTheDocument();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('renders icon inside the button', () => {
|
|
23
|
-
const { getByText } = render(
|
|
24
|
-
<PrimaryButton iconName="Arrow" onClick={onClick}>
|
|
25
|
-
Primary button text
|
|
26
|
-
</PrimaryButton>
|
|
27
|
-
);
|
|
28
|
-
const button = getByText('Primary button text');
|
|
29
|
-
|
|
30
|
-
expect(within(button).getByTestId('button-icon')).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('calls onClick callback when button is clicked', () => {
|
|
34
|
-
const { getByText } = render(<PrimaryButton onClick={onClick}>Primary button text</PrimaryButton>);
|
|
35
|
-
|
|
36
|
-
fireEvent.click(getByText('Primary button text'));
|
|
37
|
-
expect(onClick).toBeCalled();
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent } from 'react';
|
|
2
|
-
import PrimaryButtonWrapper from './PrimaryButtonWrapper.style';
|
|
3
|
-
import { Colors } from '../../../../types/types';
|
|
4
|
-
import { IPrimaryButtonProps } from '../../../../types/buttonTypes';
|
|
5
|
-
|
|
6
|
-
const PrimaryButton: FunctionComponent<IPrimaryButtonProps> = ({ children, ...props }) => {
|
|
7
|
-
return (
|
|
8
|
-
<PrimaryButtonWrapper color={Colors.White} {...props}>
|
|
9
|
-
{children}
|
|
10
|
-
</PrimaryButtonWrapper>
|
|
11
|
-
);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default PrimaryButton;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import Button from '../Button';
|
|
3
|
-
import { IPrimaryButtonProps } from '../../../../types/buttonTypes';
|
|
4
|
-
import { Colors } from '../../../../types/types';
|
|
5
|
-
|
|
6
|
-
const PrimaryButtonWrapper = styled(Button)<IPrimaryButtonProps>`
|
|
7
|
-
background-color: var(--base-color-${({ bgColor = Colors.Primary }) => bgColor});
|
|
8
|
-
border-color: var(--base-color-${({ bgColor = Colors.Primary }) => bgColor});
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
export default PrimaryButtonWrapper;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React, { MouseEventHandler } from 'react';
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import SecondaryButton from './SecondaryButton';
|
|
4
|
-
import GlobalStyles from '../../../../styles/GlobalStyles';
|
|
5
|
-
import ThemeProvider from '../../../../styles/ThemeProvider';
|
|
6
|
-
import { ThemeType, Colors } from '../../../../types/types';
|
|
7
|
-
import { DirectionType, IconNameType } from '../../../../types/iconTypes';
|
|
8
|
-
|
|
9
|
-
const meta: Meta = {
|
|
10
|
-
title: 'Components/Foundations/Buttons/Secondary',
|
|
11
|
-
component: SecondaryButton,
|
|
12
|
-
argTypes: {
|
|
13
|
-
color: {
|
|
14
|
-
description: 'Text and border color',
|
|
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: 'Secondary button',
|
|
41
|
-
withSource: 'none',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
design: {
|
|
45
|
-
type: 'figma',
|
|
46
|
-
url: 'https://www.figma.com/file/PtlqtJAjr87djTyD0x40m9/ROH:-Design-System-and-Documentation?node-id=3%3A1497',
|
|
47
|
-
},
|
|
48
|
-
jest: ['SecondaryButton'],
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default meta;
|
|
53
|
-
|
|
54
|
-
interface IStorybookSecondaryButtonProps {
|
|
55
|
-
text: string;
|
|
56
|
-
color?: Colors;
|
|
57
|
-
iconName?: IconNameType;
|
|
58
|
-
iconDirection?: DirectionType;
|
|
59
|
-
onClick: MouseEventHandler<any>;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const SecondaryButtonTemplate: Story<IStorybookSecondaryButtonProps> = (args) => (
|
|
63
|
-
<SecondaryButton {...args}>{args.text}</SecondaryButton>
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
export const ButtonWithNoIcon = SecondaryButtonTemplate.bind({});
|
|
67
|
-
ButtonWithNoIcon.args = {
|
|
68
|
-
onClick: () => console.log('click!'),
|
|
69
|
-
text: 'Button Text',
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const ButtonWithIcon = SecondaryButtonTemplate.bind({});
|
|
73
|
-
ButtonWithIcon.args = {
|
|
74
|
-
onClick: () => console.log('click!'),
|
|
75
|
-
iconName: 'BookTickets',
|
|
76
|
-
text: 'Button Text',
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const ButtonWithLongText = SecondaryButtonTemplate.bind({});
|
|
80
|
-
ButtonWithLongText.args = {
|
|
81
|
-
onClick: () => console.log('click!'),
|
|
82
|
-
iconName: 'BookTickets',
|
|
83
|
-
text: 'Very Very Long Button Truncated Text',
|
|
84
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, within, fireEvent } from '@testing-library/react';
|
|
3
|
-
import SecondaryButton from './SecondaryButton';
|
|
4
|
-
|
|
5
|
-
describe('SecondaryButton component', () => {
|
|
6
|
-
const onClick = jest.fn();
|
|
7
|
-
it('renders button with specific text', () => {
|
|
8
|
-
const { getByText } = render(<SecondaryButton onClick={onClick}>Secondary button text</SecondaryButton>);
|
|
9
|
-
|
|
10
|
-
expect(getByText('Secondary button text')).toBeInTheDocument();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('truncates button text if its length is greater than 30 characters', () => {
|
|
14
|
-
const { getByText, queryAllByText } = render(
|
|
15
|
-
<SecondaryButton onClick={onClick}>Very Very Long Secondary button text</SecondaryButton>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
expect(queryAllByText('Very Very Long Secondary button text')).toHaveLength(0);
|
|
19
|
-
expect(getByText('Very Very Long Secondary butto')).toBeInTheDocument();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('renders icon inside the button', () => {
|
|
23
|
-
const { getByText } = render(
|
|
24
|
-
<SecondaryButton iconName="Arrow" onClick={onClick}>
|
|
25
|
-
Secondary button text
|
|
26
|
-
</SecondaryButton>
|
|
27
|
-
);
|
|
28
|
-
const button = getByText('Secondary button text');
|
|
29
|
-
|
|
30
|
-
expect(within(button).getByTestId('button-icon')).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('calls onClick callback when button is clicked', () => {
|
|
34
|
-
const { getByText } = render(<SecondaryButton onClick={onClick}>Secondary button text</SecondaryButton>);
|
|
35
|
-
|
|
36
|
-
fireEvent.click(getByText('Secondary button text'));
|
|
37
|
-
expect(onClick).toBeCalled();
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent } from 'react';
|
|
2
|
-
import SecondaryButtonWrapper from './SecondaryButtonWrapper.style';
|
|
3
|
-
import { Colors } from '../../../../types/types';
|
|
4
|
-
import { IButtonProps } from '../../../../types/buttonTypes';
|
|
5
|
-
|
|
6
|
-
const SecondaryButton: FunctionComponent<IButtonProps> = ({ children, ...props }) => {
|
|
7
|
-
return (
|
|
8
|
-
<SecondaryButtonWrapper color={Colors.Primary} {...props}>
|
|
9
|
-
{children}
|
|
10
|
-
</SecondaryButtonWrapper>
|
|
11
|
-
);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default SecondaryButton;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import Button from '../Button';
|
|
3
|
-
import { IButtonProps } from '../../../../types/buttonTypes';
|
|
4
|
-
import { Colors } from '../../../../types/types';
|
|
5
|
-
|
|
6
|
-
const PrimaryButtonWrapper = styled(Button)<IButtonProps>`
|
|
7
|
-
background-color: var(--base-color-transparent);
|
|
8
|
-
border-color: var(--base-color-${({ color = Colors.Primary }) => color});
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
export default PrimaryButtonWrapper;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React, { MouseEventHandler } from 'react';
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import TertiaryButton from './TertiaryButton';
|
|
4
|
-
import GlobalStyles from '../../../../styles/GlobalStyles';
|
|
5
|
-
import ThemeProvider from '../../../../styles/ThemeProvider';
|
|
6
|
-
import { ThemeType, Colors } from '../../../../types/types';
|
|
7
|
-
|
|
8
|
-
const meta: Meta = {
|
|
9
|
-
title: 'Components/Foundations/Buttons/Tertiary',
|
|
10
|
-
component: TertiaryButton,
|
|
11
|
-
argTypes: {
|
|
12
|
-
color: {
|
|
13
|
-
description: 'Text and icon color',
|
|
14
|
-
},
|
|
15
|
-
ref: {
|
|
16
|
-
table: { disable: true },
|
|
17
|
-
},
|
|
18
|
-
theme: {
|
|
19
|
-
table: { disable: true },
|
|
20
|
-
},
|
|
21
|
-
as: {
|
|
22
|
-
table: { disable: true },
|
|
23
|
-
},
|
|
24
|
-
forwardedAs: {
|
|
25
|
-
table: { disable: true },
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
decorators: [
|
|
29
|
-
(Story) => (
|
|
30
|
-
<ThemeProvider theme={ThemeType.Core}>
|
|
31
|
-
<GlobalStyles />
|
|
32
|
-
{Story()}
|
|
33
|
-
</ThemeProvider>
|
|
34
|
-
),
|
|
35
|
-
],
|
|
36
|
-
parameters: {
|
|
37
|
-
docs: {
|
|
38
|
-
description: {
|
|
39
|
-
component: 'Tertiary button',
|
|
40
|
-
withSource: 'none',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
design: {
|
|
44
|
-
type: 'figma',
|
|
45
|
-
url: 'https://www.figma.com/file/PtlqtJAjr87djTyD0x40m9/ROH:-Design-System-and-Documentation?node-id=3%3A1497',
|
|
46
|
-
},
|
|
47
|
-
jest: ['TertiaryButton'],
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default meta;
|
|
52
|
-
|
|
53
|
-
interface IStorybookTertiaryButtonProps {
|
|
54
|
-
text: string;
|
|
55
|
-
color?: Colors;
|
|
56
|
-
onClick: MouseEventHandler<any>;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const TertiaryButtonTemplate: Story<IStorybookTertiaryButtonProps> = (args) => (
|
|
60
|
-
<TertiaryButton {...args}>{args.text}</TertiaryButton>
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
export const Button = TertiaryButtonTemplate.bind({});
|
|
64
|
-
Button.args = {
|
|
65
|
-
onClick: () => console.log('click!'),
|
|
66
|
-
text: 'Button Text',
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const ButtonWithLongText = TertiaryButtonTemplate.bind({});
|
|
70
|
-
ButtonWithLongText.args = {
|
|
71
|
-
onClick: () => console.log('click!'),
|
|
72
|
-
text: 'Very Very Long Button Truncated Text',
|
|
73
|
-
};
|