@royaloperahouse/chord 0.9.0 → 1.1.0-b-chord-development
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/CHANGELOG.md +4 -0
- package/README.md +99 -44
- package/dist/chord.cjs.development.js +26 -13
- 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 +26 -13
- package/dist/chord.esm.js.map +1 -1
- package/dist/types/card.d.ts +4 -0
- package/package.json +1 -1
- package/README.GIT +0 -122
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,67 +1,122 @@
|
|
|
1
|
-
# Royal Opera House -
|
|
1
|
+
# Royal Opera House - Front End Design System
|
|
2
2
|
|
|
3
|
-
Welcome to the Royal Opera House
|
|
3
|
+
Welcome to the Royal Opera House Front End Design System, `@royaloperahouse/chord`.
|
|
4
4
|
|
|
5
5
|
This package is a library of UI components intended to be used in the ROH website.
|
|
6
6
|
|
|
7
|
+
It uses React, TypeScript, TSDX and Storybook.
|
|
7
8
|
|
|
8
|
-
##
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
The required package dependencies need to be insalled using `yarn`. Once ready you can issue the following:
|
|
12
|
+
|
|
13
|
+
To run Lint on the package use:
|
|
9
14
|
|
|
10
15
|
```bash
|
|
11
|
-
|
|
16
|
+
yarn lint # you can also use the --fix option to perform automatic fixes
|
|
12
17
|
```
|
|
18
|
+
|
|
19
|
+
To run the unit tests (using Jest) use:
|
|
20
|
+
|
|
13
21
|
```bash
|
|
14
|
-
|
|
22
|
+
yarn test # you can also use the -u option to update snapshots if needed
|
|
15
23
|
```
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
To run the unit tests (using Jest) and store them for display in storybook use:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
yarn test-storybook # you can also use the -u option to update snapshots if needed
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
To run storybook use:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
yarn storybook
|
|
35
|
+
```
|
|
18
36
|
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
Footer, GlobalStyles, ThemeProvider, ThemeType,
|
|
22
|
-
} from '@royaloperahouse/chord';
|
|
37
|
+
To build a static version of storybook use:
|
|
23
38
|
|
|
39
|
+
```bash
|
|
40
|
+
yarn build-storybook
|
|
24
41
|
```
|
|
25
|
-
## Sample
|
|
26
|
-
|
|
27
|
-
```javascript
|
|
28
|
-
|
|
29
|
-
import {
|
|
30
|
-
Footer, GlobalStyles, ThemeProvider, ThemeType,
|
|
31
|
-
} from '@royaloperahouse/chord';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const App = ({ children }: InnerProps): React.ReactElement => (
|
|
35
|
-
<ErrorBoundary>
|
|
36
|
-
<ThemeProvider theme={ThemeType.Core}>
|
|
37
|
-
<GlobalStyles />
|
|
38
|
-
<Wrapper>
|
|
39
|
-
<Header />
|
|
40
|
-
<GlobalStyle />
|
|
41
|
-
<HealthBanner />
|
|
42
|
-
<ErrorBoundary>
|
|
43
|
-
<Content>
|
|
44
|
-
{children}
|
|
45
|
-
</Content>
|
|
46
|
-
</ErrorBoundary>
|
|
47
|
-
<LiveChat />
|
|
48
|
-
</Wrapper>
|
|
49
|
-
<Footer data={footerData} />
|
|
50
|
-
</ThemeProvider>
|
|
51
|
-
</ErrorBoundary>
|
|
52
|
-
);
|
|
53
42
|
|
|
43
|
+
This will create a static copy in `./storybook-static`, and there is an index.html page inside the core directory. This allows the site to be previewed directly in the git repository via serving pages (it needs to be configured for that branch).
|
|
44
|
+
|
|
45
|
+
To deploy the storybook publically:
|
|
46
|
+
|
|
47
|
+
### Prerequisites
|
|
48
|
+
|
|
49
|
+
Make sure you have credentials for the *parent* 'Royal Opera House' AWS account in your `~/.aws/credentials` file. The deploy script expects these to be called `[parent]`.
|
|
50
|
+
|
|
51
|
+
You can get these values at:
|
|
52
|
+
|
|
53
|
+
AWS 'Your Applications' page -> 'Royal Opera House' -> 'Developer Access' ->
|
|
54
|
+
'Command line or programmatic access'
|
|
55
|
+
|
|
56
|
+
### Deployment
|
|
57
|
+
|
|
58
|
+
To deploy, first *build* the storybook as above
|
|
59
|
+
|
|
60
|
+
then use:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
yarn deploy-storybook
|
|
54
64
|
```
|
|
55
65
|
|
|
56
|
-
|
|
66
|
+
This will deploy the contents of `./storybook-static` to S3 as a static site accessible at [chord.roh.org.uk](chord.roh.org.uk)
|
|
67
|
+
|
|
68
|
+
To build the package use:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
yarn build
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
To release a new version.
|
|
75
|
+
|
|
76
|
+
Release will be published in npm (NPM_TOKEN will be required)
|
|
77
|
+
Storybook will be pushed to bitbucket. *** Push will be done Ensure you don't have things pendint to push
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-release
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
MORE INFO TO FOLLOW - PARTICULARLY FOR THE CI SETUP AND HOW PACKAGES ARE PUSHED.
|
|
85
|
+
|
|
86
|
+
# Recommended Use of Package
|
|
87
|
+
|
|
88
|
+
The package is deployed to NPM, and can be installed using yarn or npm:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm i --save @royaloperahouse/chord
|
|
92
|
+
```
|
|
93
|
+
```bash
|
|
94
|
+
yarn add @royaloperahouse/chord
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
# Processes to follow prior to commits
|
|
98
|
+
|
|
99
|
+
Before a commit is made you need to do the following:
|
|
100
|
+
|
|
101
|
+
- Make sure that you are in your own work branch (properly named, including the JIRA ticket number and a short description)
|
|
102
|
+
- `yarn lint` - ensure that you are not introducing errors
|
|
103
|
+
- `yarn test` - ensure that tests are running as expected
|
|
104
|
+
- `yarn test-storybook` - Save the test results to for the static site
|
|
105
|
+
- `yarn build-storybook` - Update the static site
|
|
106
|
+
- Commit your changes in your branch locally
|
|
57
107
|
|
|
58
|
-
|
|
108
|
+
Next, if you are ready to merge into the main development branch then:
|
|
59
109
|
|
|
60
|
-
|
|
110
|
+
- _*ensure that you pull the latest changes from that branch into your new branch, resolving any merge conflicts that may arise*_
|
|
111
|
+
- Commit any merge changes locally
|
|
112
|
+
- Push your branch changes to the origin repo
|
|
113
|
+
- Raise a Pull Request to merge back into the main development branch, AND ensure that the required reviewers are assigned.
|
|
114
|
+
- The reviewers may raise issues, and once resolved, they will be responsible for performing the merge.
|
|
61
115
|
|
|
62
|
-
|
|
116
|
+
### Example
|
|
63
117
|
|
|
118
|
+
There is an example implementation in the example folder. Alternatively there are also integration examples in storybook. Make sure to keep these updated so as to showcase the current components available.
|
|
64
119
|
|
|
65
|
-
|
|
120
|
+
### Bundle analysis
|
|
66
121
|
|
|
67
|
-
|
|
122
|
+
Calculates the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `yarn size` and visulize it with `yarn analyze`.
|
|
@@ -4683,12 +4683,12 @@ var TitleCTAGridWrapper = /*#__PURE__*/styled__default.div(_templateObject$A ||
|
|
|
4683
4683
|
return sticky ? 'sticky' : 'initial';
|
|
4684
4684
|
}, zIndexes.anchor);
|
|
4685
4685
|
var TitleCTAGrid = /*#__PURE__*/styled__default(Grid)(_templateObject2$k || (_templateObject2$k = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-bottom: solid 2px var(--base-color-lightgrey);\n"])));
|
|
4686
|
-
var TitleCTAGridItem = /*#__PURE__*/styled__default.div(_templateObject3$e || (_templateObject3$e = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n grid-column: 2 / span 15;\n display: flex;\n flex-direction: ", ";\n gap: 40px;\n justify-content: space-between;\n\n @media ", " {\n & {\n grid-column: 2 / span 13;\n gap: 20px;\n }\n }\n\n @media ", " {\n & {\n grid-column: 2 / span 12;\n }\n }\n"])), function (_ref2) {
|
|
4686
|
+
var TitleCTAGridItem = /*#__PURE__*/styled__default.div(_templateObject3$e || (_templateObject3$e = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n grid-column: 2 / span 15;\n display: flex;\n align-items: center;\n flex-direction: ", ";\n gap: 40px;\n justify-content: space-between;\n\n @media ", " {\n & {\n grid-column: 2 / span 13;\n gap: 20px;\n }\n }\n\n @media ", " {\n & {\n grid-column: 2 / span 12;\n }\n }\n"])), function (_ref2) {
|
|
4687
4687
|
var title = _ref2.title;
|
|
4688
4688
|
return title ? 'row' : 'row-reverse';
|
|
4689
4689
|
}, devices.tablet, devices.mobile);
|
|
4690
|
-
var AnchorTitle = /*#__PURE__*/styled__default.div(_templateObject4$a || (_templateObject4$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n height: var(--button-height);\n\n h5 {\n padding: 0;\n margin: 0;\n }\n\n @media ", " {\n & {\n height: 50px;\n }\n }\n"])), devices.mobile);
|
|
4691
|
-
var ButtonsDesktopWrapper = /*#__PURE__*/styled__default.div(_templateObject6$6 || (_templateObject6$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: flex-end;\n\n @media ", " {\n display: none;\n }\n"])), devices.mobile);
|
|
4690
|
+
var AnchorTitle = /*#__PURE__*/styled__default.div(_templateObject4$a || (_templateObject4$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n min-height: var(--button-height);\n\n h5 {\n padding: 0;\n margin: 0;\n }\n\n @media ", " {\n & {\n min-height: 50px;\n }\n }\n"])), devices.mobile);
|
|
4691
|
+
var ButtonsDesktopWrapper = /*#__PURE__*/styled__default.div(_templateObject6$6 || (_templateObject6$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: flex-end;\n\n @media ", " {\n display: none;\n }\n\n a {\n width: max-content;\n }\n"])), devices.mobile);
|
|
4692
4692
|
var ButtonsMobileWrapper = /*#__PURE__*/styled__default.div(_templateObject7$3 || (_templateObject7$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: none;\n\n @media ", " {\n & {\n display: block;\n }\n }\n"])), devices.mobile);
|
|
4693
4693
|
var PrimaryButtonReverse = /*#__PURE__*/styled__default(PrimaryButton)(_templateObject8$3 || (_templateObject8$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n && {\n background-color: ", ";\n border-color: ", ";\n color: ", ";\n svg path {\n fill: ", ";\n }\n }\n"])), function (_ref3) {
|
|
4694
4694
|
var theme = _ref3.theme;
|
|
@@ -4962,7 +4962,7 @@ var _templateObject$F, _templateObject2$o, _templateObject3$h, _templateObject4$
|
|
|
4962
4962
|
var LENGTH_LARGE_TEXT = 28;
|
|
4963
4963
|
var LENGTH_SMALL_TEXT = 19;
|
|
4964
4964
|
var LENGTH_TEXT_TABLET = 10;
|
|
4965
|
-
var CardContainer = /*#__PURE__*/styled__default.div(_templateObject$F || (_templateObject$F = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n ", "\n\n .targetLink {\n text-decoration: none;\n color: inherit;\n }\n"])), function (_ref) {
|
|
4965
|
+
var CardContainer = /*#__PURE__*/styled__default.div(_templateObject$F || (_templateObject$F = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n position: relative;\n ", "\n\n .targetLink {\n text-decoration: none;\n color: inherit;\n }\n"])), function (_ref) {
|
|
4966
4966
|
var onlyShowButtonsOnHover = _ref.onlyShowButtonsOnHover;
|
|
4967
4967
|
return !onlyShowButtonsOnHover ? "height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between; \n " : '';
|
|
4968
4968
|
});
|
|
@@ -4985,10 +4985,15 @@ var getButtonsOpacity = function getButtonsOpacity(_ref4) {
|
|
|
4985
4985
|
return onlyShowButtonsOnHover ? 'opacity: 0;' : 'opacity: 1;';
|
|
4986
4986
|
};
|
|
4987
4987
|
|
|
4988
|
-
var
|
|
4989
|
-
var
|
|
4990
|
-
|
|
4991
|
-
|
|
4988
|
+
var getButtonsMinHeight = function getButtonsMinHeight(_ref5) {
|
|
4989
|
+
var onlyShowButtonsOnHover = _ref5.onlyShowButtonsOnHover;
|
|
4990
|
+
return onlyShowButtonsOnHover ? 'min-height: unset;' : 'min-height: 120px;';
|
|
4991
|
+
};
|
|
4992
|
+
|
|
4993
|
+
var ButtonsContainer$1 = /*#__PURE__*/styled__default.div(_templateObject9$3 || (_templateObject9$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", ";\n display: flex;\n gap: 16px;\n margin-top: var(--editorial-margin-between);\n\n ", "\n\n @media ", " {\n ", ";\n margin-left: ", ";\n margin-right: ", ";\n opacity: 1 !important;\n gap: 24px;\n margin-top: 24px;\n flex-direction: column;\n align-items: center;\n }\n\n @media ", " {\n ", ";\n opacity: 1 !important;\n gap: 24px;\n margin-top: 24px;\n align-items: flex-start;\n\n ", "\n }\n"])), getButtonsOpacity, function (_ref6) {
|
|
4994
|
+
var size = _ref6.size,
|
|
4995
|
+
primaryButtonTextLength = _ref6.primaryButtonTextLength,
|
|
4996
|
+
tertiaryButtonTextLength = _ref6.tertiaryButtonTextLength;
|
|
4992
4997
|
var isLinksLayoutColumn = size === 'small' ? primaryButtonTextLength >= LENGTH_SMALL_TEXT || tertiaryButtonTextLength >= LENGTH_SMALL_TEXT : primaryButtonTextLength >= LENGTH_LARGE_TEXT || tertiaryButtonTextLength >= LENGTH_LARGE_TEXT;
|
|
4993
4998
|
|
|
4994
4999
|
if (isLinksLayoutColumn) {
|
|
@@ -4996,9 +5001,15 @@ var ButtonsContainer$1 = /*#__PURE__*/styled__default.div(_templateObject9$3 ||
|
|
|
4996
5001
|
}
|
|
4997
5002
|
|
|
4998
5003
|
return '';
|
|
4999
|
-
}, devices.mobile,
|
|
5000
|
-
var
|
|
5001
|
-
|
|
5004
|
+
}, devices.mobile, getButtonsMinHeight, function (_ref7) {
|
|
5005
|
+
var fullWidth = _ref7.fullWidth;
|
|
5006
|
+
return fullWidth ? '0' : '20px';
|
|
5007
|
+
}, function (_ref8) {
|
|
5008
|
+
var fullWidth = _ref8.fullWidth;
|
|
5009
|
+
return fullWidth ? '0' : '20px';
|
|
5010
|
+
}, devices.tablet, getButtonsMinHeight, function (_ref9) {
|
|
5011
|
+
var primaryButtonTextLength = _ref9.primaryButtonTextLength,
|
|
5012
|
+
tertiaryButtonTextLength = _ref9.tertiaryButtonTextLength;
|
|
5002
5013
|
var isLinksLayoutColumnTablet = primaryButtonTextLength >= LENGTH_TEXT_TABLET || tertiaryButtonTextLength >= LENGTH_TEXT_TABLET;
|
|
5003
5014
|
|
|
5004
5015
|
if (isLinksLayoutColumnTablet) {
|
|
@@ -5147,7 +5158,8 @@ var Card = function Card(_ref) {
|
|
|
5147
5158
|
size: size,
|
|
5148
5159
|
primaryButtonTextLength: firstButtonText.length,
|
|
5149
5160
|
tertiaryButtonTextLength: secondButtonText.length,
|
|
5150
|
-
onlyShowButtonsOnHover: onlyShowButtonsOnHover
|
|
5161
|
+
onlyShowButtonsOnHover: onlyShowButtonsOnHover,
|
|
5162
|
+
fullWidth: fullWidth
|
|
5151
5163
|
}, firstButton && /*#__PURE__*/React__default.createElement(FirstButtonComponent, Object.assign({}, restFirstButton), primaryButtonTextTruncate), secondButton && /*#__PURE__*/React__default.createElement(SecondButtonComponent, Object.assign({}, restSecondButton), tertiaryButtonTextTruncate)));
|
|
5152
5164
|
};
|
|
5153
5165
|
|
|
@@ -5186,7 +5198,8 @@ var Cards = function Cards(_ref) {
|
|
|
5186
5198
|
links: card.links,
|
|
5187
5199
|
tags: card.tags,
|
|
5188
5200
|
withContinueWatching: card.withContinueWatching,
|
|
5189
|
-
onlyShowButtonsOnHover: card.onlyShowButtonsOnHover
|
|
5201
|
+
onlyShowButtonsOnHover: card.onlyShowButtonsOnHover,
|
|
5202
|
+
fullWidth: card.fullWidth
|
|
5190
5203
|
}));
|
|
5191
5204
|
}));
|
|
5192
5205
|
};
|