@times-components/ts-components 1.32.3 → 1.33.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/CHANGELOG.md +27 -0
- package/dist/components/styleguide/Styleguide.d.ts +193 -0
- package/dist/components/styleguide/Styleguide.js +24 -0
- package/dist/components/styleguide/__tests__/breakpoints.test.d.ts +1 -0
- package/dist/components/styleguide/__tests__/breakpoints.test.js +46 -0
- package/dist/components/styleguide/__tests__/styleguide.test.d.ts +1 -0
- package/dist/components/styleguide/__tests__/styleguide.test.js +48 -0
- package/dist/components/styleguide/__tests__/themeFactory.test.d.ts +1 -0
- package/dist/components/styleguide/__tests__/themeFactory.test.js +41 -0
- package/dist/components/styleguide/breakpoints.d.ts +37 -0
- package/dist/components/styleguide/breakpoints.js +42 -0
- package/dist/components/styleguide/colours/colours.d.ts +103 -0
- package/dist/components/styleguide/colours/colours.js +8 -0
- package/dist/components/styleguide/colours/functional.d.ts +32 -0
- package/dist/components/styleguide/colours/functional.js +33 -0
- package/dist/components/styleguide/colours/section.d.ts +68 -0
- package/dist/components/styleguide/colours/section.js +78 -0
- package/dist/components/styleguide/components/Animations.d.ts +6 -0
- package/dist/components/styleguide/components/Animations.js +19 -0
- package/dist/components/styleguide/components/TcText.d.ts +6 -0
- package/dist/components/styleguide/components/TcText.js +22 -0
- package/dist/components/styleguide/components/TcView.d.ts +6 -0
- package/dist/components/styleguide/components/TcView.js +21 -0
- package/dist/components/styleguide/components/index.d.ts +4 -0
- package/dist/components/styleguide/components/index.js +5 -0
- package/dist/components/styleguide/fonts/font-factory.d.ts +10 -0
- package/dist/components/styleguide/fonts/font-factory.js +12 -0
- package/dist/components/styleguide/fonts/font-sizes.d.ts +47 -0
- package/dist/components/styleguide/fonts/font-sizes.js +47 -0
- package/dist/components/styleguide/fonts/font-styles.d.ts +13 -0
- package/dist/components/styleguide/fonts/font-styles.js +13 -0
- package/dist/components/styleguide/fonts/fonts.d.ts +4 -0
- package/dist/components/styleguide/fonts/fonts.js +5 -0
- package/dist/components/styleguide/helpers/storybookStyles.d.ts +2 -0
- package/dist/components/styleguide/helpers/storybookStyles.js +54 -0
- package/dist/components/styleguide/lineHeight.d.ts +7 -0
- package/dist/components/styleguide/lineHeight.js +65 -0
- package/dist/components/styleguide/scales.d.ts +6 -0
- package/dist/components/styleguide/scales.js +6 -0
- package/dist/components/styleguide/spacing.d.ts +11 -0
- package/dist/components/styleguide/spacing.js +17 -0
- package/dist/components/styleguide/styleguide.stories.d.ts +1 -0
- package/dist/components/styleguide/styleguide.stories.js +71 -0
- package/dist/components/styleguide/themeFactory.d.ts +8 -0
- package/dist/components/styleguide/themeFactory.js +59 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/package.json +13 -13
- package/rnw.js +1 -1
- package/src/components/styleguide/Styleguide.tsx +54 -0
- package/src/components/styleguide/__tests__/breakpoints.test.ts +67 -0
- package/src/components/styleguide/__tests__/styleguide.test.tsx +68 -0
- package/src/components/styleguide/__tests__/themeFactory.test.ts +44 -0
- package/src/components/styleguide/breakpoints.tsx +52 -0
- package/src/components/styleguide/colours/colours.tsx +8 -0
- package/src/components/styleguide/colours/functional.tsx +32 -0
- package/src/components/styleguide/colours/section.tsx +81 -0
- package/src/components/styleguide/components/Animations.tsx +22 -0
- package/src/components/styleguide/components/TcText.tsx +32 -0
- package/src/components/styleguide/components/TcView.tsx +27 -0
- package/src/components/styleguide/components/index.tsx +5 -0
- package/src/components/styleguide/fonts/font-factory.tsx +18 -0
- package/src/components/styleguide/fonts/font-sizes.tsx +46 -0
- package/src/components/styleguide/fonts/font-styles.tsx +12 -0
- package/src/components/styleguide/fonts/fonts.tsx +5 -0
- package/src/components/styleguide/helpers/storybookStyles.ts +55 -0
- package/src/components/styleguide/lineHeight.tsx +73 -0
- package/src/components/styleguide/scales.tsx +5 -0
- package/src/components/styleguide/spacing.tsx +19 -0
- package/src/components/styleguide/styleguide.stories.tsx +143 -0
- package/src/components/styleguide/themeFactory.tsx +82 -0
- package/src/index.ts +21 -0
- package/src/types/externs.d.ts +14 -2
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import colours from './colours/colours';
|
|
3
|
+
import Animations from './components/Animations';
|
|
4
|
+
|
|
5
|
+
import breakpoints, {
|
|
6
|
+
editionBreakpoints,
|
|
7
|
+
editionMaxWidth,
|
|
8
|
+
getEditionBreakpoint,
|
|
9
|
+
editionBreakpointWidths,
|
|
10
|
+
sliceContentMaxWidth
|
|
11
|
+
} from './breakpoints';
|
|
12
|
+
import lineHeight from './lineHeight';
|
|
13
|
+
import { timesFontFactory, timesFontSizes, fontStyles } from './fonts/fonts';
|
|
14
|
+
import themeFactory from './themeFactory';
|
|
15
|
+
|
|
16
|
+
import scales from './scales';
|
|
17
|
+
import spacing, { globalSpacingStyles } from './spacing';
|
|
18
|
+
|
|
19
|
+
const { nativeTablet, nativeTabletWide } = breakpoints;
|
|
20
|
+
|
|
21
|
+
export const tabletRowPadding = 20;
|
|
22
|
+
|
|
23
|
+
export default () => {
|
|
24
|
+
return {
|
|
25
|
+
Animations,
|
|
26
|
+
colours,
|
|
27
|
+
fontFactory: timesFontFactory,
|
|
28
|
+
fonts: fontStyles,
|
|
29
|
+
fontSizes: timesFontSizes,
|
|
30
|
+
lineHeight,
|
|
31
|
+
spacing
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
Animations,
|
|
37
|
+
breakpoints,
|
|
38
|
+
colours,
|
|
39
|
+
editionBreakpoints,
|
|
40
|
+
editionBreakpointWidths,
|
|
41
|
+
editionMaxWidth,
|
|
42
|
+
sliceContentMaxWidth,
|
|
43
|
+
fontStyles as fonts,
|
|
44
|
+
timesFontFactory as fontFactory,
|
|
45
|
+
timesFontSizes as fontSizes,
|
|
46
|
+
getEditionBreakpoint,
|
|
47
|
+
lineHeight,
|
|
48
|
+
scales,
|
|
49
|
+
spacing,
|
|
50
|
+
globalSpacingStyles,
|
|
51
|
+
nativeTablet as tabletWidth,
|
|
52
|
+
nativeTabletWide as tabletWidthMax,
|
|
53
|
+
themeFactory
|
|
54
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import '@testing-library/react';
|
|
2
|
+
|
|
3
|
+
import breakpoints, {
|
|
4
|
+
editionBreakpointWidths,
|
|
5
|
+
editionBreakpoints
|
|
6
|
+
} from '../breakpoints';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
getEditionBreakpoint,
|
|
10
|
+
sliceContentMaxWidth,
|
|
11
|
+
editionMaxWidth,
|
|
12
|
+
globalSpacingStyles,
|
|
13
|
+
editionBreakpointWidths as styleguideEditionBreakpointWidths,
|
|
14
|
+
editionBreakpoints as styleguideEditionBreakpoints
|
|
15
|
+
} from '../Styleguide';
|
|
16
|
+
|
|
17
|
+
describe('breakpoints', () => {
|
|
18
|
+
it('should return correct globalSpacingStyles value', () => {
|
|
19
|
+
expect(globalSpacingStyles).toEqual({
|
|
20
|
+
tabletHeadline: { marginBottom: 5 },
|
|
21
|
+
tabletTeaser: { marginTop: 5 }
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
it('should return correct sliceContentMaxWidth value', () => {
|
|
25
|
+
expect(sliceContentMaxWidth).toEqual(1180);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should return correct sliceContentMaxWidth value', () => {
|
|
29
|
+
expect(sliceContentMaxWidth).toEqual(1180);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should return correct editionBreakpointWidths value', () => {
|
|
33
|
+
expect(editionBreakpointWidths.wide).toEqual(1024);
|
|
34
|
+
expect(styleguideEditionBreakpointWidths.wide).toEqual(1024);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should return correct editionMaxWidth value', () => {
|
|
38
|
+
expect(editionMaxWidth).toEqual(1366);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should return correct breakpoint width value', () => {
|
|
42
|
+
expect(breakpoints.huge).toEqual(1320);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should retun correct editionBreakpoints value', () => {
|
|
46
|
+
expect(editionBreakpoints.huge).toEqual('huge');
|
|
47
|
+
expect(styleguideEditionBreakpoints.huge).toEqual('huge');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('getEditionBreakpoint()', () => {
|
|
51
|
+
it('should return correct getEditionBreakpoint value', () => {
|
|
52
|
+
expect(getEditionBreakpoint(600)).toEqual('small');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should return correct getEditionBreakpoint value', () => {
|
|
56
|
+
expect(getEditionBreakpoint(900)).toEqual('medium');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should return correct getEditionBreakpoint value', () => {
|
|
60
|
+
expect(getEditionBreakpoint(1100)).toEqual('wide');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should return correct getEditionBreakpoint value', () => {
|
|
64
|
+
expect(getEditionBreakpoint(1500)).toEqual('huge');
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
|
|
4
|
+
import styleguide, { colours, fonts, spacing } from '../Styleguide';
|
|
5
|
+
import { Animations, TcText, TcView } from '../components';
|
|
6
|
+
|
|
7
|
+
import styles from '../helpers/storybookStyles';
|
|
8
|
+
|
|
9
|
+
describe('styleguide', () => {
|
|
10
|
+
it('should return correct storybook style', () => {
|
|
11
|
+
expect(styles.box.height).toEqual(100);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should render the object of section colours', () => {
|
|
15
|
+
expect(typeof colours.section).toBe('object');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should render the object of functional colours', () => {
|
|
19
|
+
expect(typeof colours.functional).toBe('object');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should multiply spacing values and add px property', () => {
|
|
23
|
+
expect(spacing(10)).toEqual('50px');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('fonts', () => {
|
|
27
|
+
it('should render the font sizes at the default scale', () => {
|
|
28
|
+
expect(styleguide().fontSizes.bodyMobile).toEqual(17);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should render the line height factory default scale', () => {
|
|
32
|
+
expect(
|
|
33
|
+
styleguide().lineHeight({
|
|
34
|
+
font: 'body',
|
|
35
|
+
fontSize: 'secondary'
|
|
36
|
+
})
|
|
37
|
+
).toEqual(27);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should render the object of font references', () => {
|
|
41
|
+
expect(typeof fonts).toBe('object');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should return object when fontFactory is called', () => {
|
|
45
|
+
expect(
|
|
46
|
+
styleguide().fontFactory({ font: 'headline', fontSize: 'body' })
|
|
47
|
+
).toEqual({
|
|
48
|
+
fontFamily: 'TimesModern-Bold',
|
|
49
|
+
fontSize: 18,
|
|
50
|
+
lineHeight: undefined
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('components', () => {
|
|
56
|
+
it('should render the Animations component', () => {
|
|
57
|
+
expect(
|
|
58
|
+
render(
|
|
59
|
+
<Animations.FadeIn>
|
|
60
|
+
<TcView style={styles.container}>
|
|
61
|
+
<TcText style={styles.text}>Hello World</TcText>
|
|
62
|
+
</TcView>
|
|
63
|
+
</Animations.FadeIn>
|
|
64
|
+
)
|
|
65
|
+
).toBeTruthy();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import '@testing-library/react';
|
|
2
|
+
import themeFactory from '../themeFactory';
|
|
3
|
+
|
|
4
|
+
describe('themeFactory()', () => {
|
|
5
|
+
it('should return correct theme when section nor template is provided', () => {
|
|
6
|
+
expect(themeFactory()).toEqual({
|
|
7
|
+
dropCapFont: 'dropCap',
|
|
8
|
+
headlineCase: null,
|
|
9
|
+
headlineFont: 'headline',
|
|
10
|
+
pullQuoteFont: 'headlineRegular',
|
|
11
|
+
sectionColour: '#1D1D1B'
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should return correct theme for an indepth style page', () => {
|
|
16
|
+
expect(themeFactory('Style', 'indepth')).toEqual({
|
|
17
|
+
dropCapFont: 'styleMagazine',
|
|
18
|
+
headlineFont: 'styleMagazine',
|
|
19
|
+
pullQuoteFont: 'styleMagazine',
|
|
20
|
+
sectionColour: undefined,
|
|
21
|
+
headlineCase: 'uppercase'
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should return correct theme for a maincomment style page', () => {
|
|
26
|
+
expect(themeFactory('Style', 'maincomment')).toEqual({
|
|
27
|
+
dropCapFont: 'dropCap',
|
|
28
|
+
headlineFont: 'headline',
|
|
29
|
+
pullQuoteFont: 'headlineRegular',
|
|
30
|
+
sectionColour: '#BC3385',
|
|
31
|
+
headlineCase: null
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should return correct theme for an indepth cultureMagazine page', () => {
|
|
36
|
+
expect(themeFactory('culture', 'indepth')).toEqual({
|
|
37
|
+
dropCapFont: 'cultureMagazine',
|
|
38
|
+
headlineFont: 'cultureMagazine',
|
|
39
|
+
pullQuoteFont: 'cultureMagazine',
|
|
40
|
+
sectionColour: undefined,
|
|
41
|
+
headlineCase: null
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const widths = {
|
|
2
|
+
huge: 1320,
|
|
3
|
+
medium: 768,
|
|
4
|
+
nativeTablet: 660,
|
|
5
|
+
nativeTabletWide: 1194,
|
|
6
|
+
small: 520,
|
|
7
|
+
wide: 1024
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const editionBreakpoints = {
|
|
11
|
+
huge: 'huge',
|
|
12
|
+
medium: 'medium',
|
|
13
|
+
small: 'small',
|
|
14
|
+
wide: 'wide'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const editionBreakpointWidths = {
|
|
18
|
+
huge: 1366,
|
|
19
|
+
medium: 768,
|
|
20
|
+
wide: 1024
|
|
21
|
+
};
|
|
22
|
+
const editionMaxWidth = editionBreakpointWidths.huge;
|
|
23
|
+
const sliceContentMaxWidth = 1180;
|
|
24
|
+
|
|
25
|
+
const getEditionBreakpoint = (width: {}) => {
|
|
26
|
+
if (width < editionBreakpointWidths.medium) {
|
|
27
|
+
return editionBreakpoints.small;
|
|
28
|
+
}
|
|
29
|
+
if (width < editionBreakpointWidths.wide) {
|
|
30
|
+
return editionBreakpoints.medium;
|
|
31
|
+
}
|
|
32
|
+
if (width < editionBreakpointWidths.huge) {
|
|
33
|
+
return editionBreakpoints.wide;
|
|
34
|
+
}
|
|
35
|
+
return editionBreakpoints.huge;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
editionBreakpoints,
|
|
40
|
+
editionMaxWidth,
|
|
41
|
+
editionBreakpointWidths,
|
|
42
|
+
sliceContentMaxWidth,
|
|
43
|
+
getEditionBreakpoint
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
editionBreakpoints,
|
|
48
|
+
editionMaxWidth,
|
|
49
|
+
editionBreakpointWidths,
|
|
50
|
+
sliceContentMaxWidth,
|
|
51
|
+
...widths
|
|
52
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const functionalColours = {
|
|
2
|
+
action: '#006699',
|
|
3
|
+
actionPressed: '#0077B3',
|
|
4
|
+
articleFlagExclusive: '#C51D24',
|
|
5
|
+
articleFlagNew: '#E34605',
|
|
6
|
+
articleFlagUpdated: '#3C81BE',
|
|
7
|
+
backgroundPrimary: '#F9F9F9',
|
|
8
|
+
backgroundSecondary: '#EDEDED',
|
|
9
|
+
black: '#000000',
|
|
10
|
+
border: '#F0F0F0',
|
|
11
|
+
brandColour: '#1D1D1B',
|
|
12
|
+
bullet: '#103546',
|
|
13
|
+
contrast: '#FFFFFF',
|
|
14
|
+
darkSupplement: '#272D34',
|
|
15
|
+
greyLabel: '#CCC',
|
|
16
|
+
greyStickyBarBoxShadow: '#c9c7c7ed',
|
|
17
|
+
greyStickyBarBorderBottom: '#ffffffdb',
|
|
18
|
+
gutter: '#f0f0f0',
|
|
19
|
+
keyline: '#DBDBDB',
|
|
20
|
+
modalBackground: '#000000',
|
|
21
|
+
newsletterPuffBackground: '#F9F8F3',
|
|
22
|
+
overlayGradientEnd: '#00000000',
|
|
23
|
+
overlayGradientFallback: '#000000B3',
|
|
24
|
+
overlayGradientStart: '#000000E6',
|
|
25
|
+
primary: '#333333',
|
|
26
|
+
secondary: '#696969',
|
|
27
|
+
tertiary: '#4D4D4D',
|
|
28
|
+
transparentBlack: 'rgba(0, 0, 0, 0.6)',
|
|
29
|
+
transparentWhite: 'rgba(255, 255, 255, 0.3)',
|
|
30
|
+
white: '#FFFFFF',
|
|
31
|
+
whiteGrey: '#F5F5F5'
|
|
32
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const primaryColoursBase = {
|
|
2
|
+
artsfeatures: '#622956',
|
|
3
|
+
bricksmortar: '#006469',
|
|
4
|
+
business: '#005B8D',
|
|
5
|
+
comment: '#850029',
|
|
6
|
+
culture: '#7B0046',
|
|
7
|
+
default: '#1D1D1B',
|
|
8
|
+
defcon: '#FF1D25',
|
|
9
|
+
driving: '#C04605',
|
|
10
|
+
focus: '#CC0000',
|
|
11
|
+
gardening: '#00313B',
|
|
12
|
+
home: '#8D724D',
|
|
13
|
+
ireland: '#004E45',
|
|
14
|
+
law: '#691D26',
|
|
15
|
+
money: '#006A74',
|
|
16
|
+
news: '#13354E',
|
|
17
|
+
newsreview: '#004D6D',
|
|
18
|
+
puzzle: '#C74600',
|
|
19
|
+
register: '#6C6C69',
|
|
20
|
+
saturdayreview: '#A31D24',
|
|
21
|
+
scotland: '#00233E',
|
|
22
|
+
sport: '#008347',
|
|
23
|
+
style: '#BC3385',
|
|
24
|
+
techgames: '#1A1F24',
|
|
25
|
+
thedish: '#DB133B',
|
|
26
|
+
thegame: '#006469',
|
|
27
|
+
thesundaytimesmagazine: '#1D1D1D',
|
|
28
|
+
thetimesmagazine: '#1D1D1D',
|
|
29
|
+
times2: '#622956',
|
|
30
|
+
todaysmagazines: '#1D1D1B',
|
|
31
|
+
travel: '#2C79AD',
|
|
32
|
+
weekend: '#05829A',
|
|
33
|
+
world: '#636C17'
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const primaryColours = {
|
|
37
|
+
'Arts & Features': primaryColoursBase.artsfeatures,
|
|
38
|
+
'Bricks & Mortar': primaryColoursBase.bricksmortar,
|
|
39
|
+
Business: primaryColoursBase.business,
|
|
40
|
+
Comment: primaryColoursBase.comment,
|
|
41
|
+
Culture: primaryColoursBase.culture,
|
|
42
|
+
Driving: primaryColoursBase.driving,
|
|
43
|
+
Focus: primaryColoursBase.focus,
|
|
44
|
+
Gardening: primaryColoursBase.gardening,
|
|
45
|
+
Home: primaryColoursBase.home,
|
|
46
|
+
Ireland: primaryColoursBase.ireland,
|
|
47
|
+
Law: primaryColoursBase.law,
|
|
48
|
+
Money: primaryColoursBase.money,
|
|
49
|
+
News: primaryColoursBase.news,
|
|
50
|
+
'News Review': primaryColoursBase.newsreview,
|
|
51
|
+
Puzzles: primaryColoursBase.puzzle,
|
|
52
|
+
Register: primaryColoursBase.register,
|
|
53
|
+
'Saturday Review': primaryColoursBase.saturdayreview,
|
|
54
|
+
Scotland: primaryColoursBase.scotland,
|
|
55
|
+
Sport: primaryColoursBase.sport,
|
|
56
|
+
Style: primaryColoursBase.style,
|
|
57
|
+
'Tech & Games': primaryColoursBase.techgames,
|
|
58
|
+
'The Dish': primaryColoursBase.thedish,
|
|
59
|
+
'The Game': primaryColoursBase.thegame,
|
|
60
|
+
'The Sunday Times Magazine': primaryColoursBase.thesundaytimesmagazine,
|
|
61
|
+
'The Times Magazine': primaryColoursBase.thetimesmagazine,
|
|
62
|
+
Times2: primaryColoursBase.times2,
|
|
63
|
+
"Today's Magazines": primaryColoursBase.todaysmagazines,
|
|
64
|
+
Travel: primaryColoursBase.travel,
|
|
65
|
+
Weekend: primaryColoursBase.weekend,
|
|
66
|
+
World: primaryColoursBase.world
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const secondaryColoursBase = {
|
|
70
|
+
thesundaytimesmagazine: '#F13D00'
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const secondaryColours = {
|
|
74
|
+
'The Sunday Times Magazine': secondaryColoursBase.thesundaytimesmagazine
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const sectionColours = { ...primaryColoursBase, ...primaryColours };
|
|
78
|
+
export const secondarySectionColours = {
|
|
79
|
+
...secondaryColoursBase,
|
|
80
|
+
...secondaryColours
|
|
81
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TcView } from '@times-components/utils';
|
|
2
|
+
import styled, { keyframes } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
const fadingAnimation = keyframes`
|
|
5
|
+
from {
|
|
6
|
+
opacity: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
to {
|
|
10
|
+
opacity: 1;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
const FadeIn = styled(TcView)`
|
|
15
|
+
animation: ${fadingAnimation} 0.3s ease-in-out;
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
const Animations = {
|
|
19
|
+
FadeIn
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Animations;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
// not sure how else to put the default styles, this the default style for a React Native <Text/> component
|
|
3
|
+
import { CSSProperties } from 'react';
|
|
4
|
+
|
|
5
|
+
type Style = CSSProperties | undefined;
|
|
6
|
+
|
|
7
|
+
export default styled.div<{ style?: Style }>`
|
|
8
|
+
border: 0px solid black;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
color: ${({ style }) =>
|
|
11
|
+
style && style.color ? style.color : 'rgb(0, 0, 0)'};
|
|
12
|
+
display: inline;
|
|
13
|
+
font: 14px system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
14
|
+
Ubuntu, 'Helvetica Neue', sans-serif;
|
|
15
|
+
margin: 0px;
|
|
16
|
+
padding: 0px;
|
|
17
|
+
white-space: pre-wrap;
|
|
18
|
+
overflow-wrap: break-word;
|
|
19
|
+
font-size: ${({ style }) =>
|
|
20
|
+
style && style.fontSize ? style.fontSize : '14px'};
|
|
21
|
+
font-weight: ${({ style }) => style && style.fontWeight && style.fontWeight};
|
|
22
|
+
margin-bottom: ${({ style }) =>
|
|
23
|
+
style && style.marginBottom ? style.marginBottom : '0px'};
|
|
24
|
+
margin-left: ${({ style }) =>
|
|
25
|
+
style && style.marginLeft ? style.marginLeft : '0px'};
|
|
26
|
+
margin-top: ${({ style }) =>
|
|
27
|
+
style && style.marginTop ? style.marginTop : '0px'};
|
|
28
|
+
font-family: ${({ style }) =>
|
|
29
|
+
style && style.fontFamily
|
|
30
|
+
? style.fontFamily
|
|
31
|
+
: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif'};
|
|
32
|
+
`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
type Style = CSSProperties | undefined;
|
|
5
|
+
|
|
6
|
+
export default styled.div<{ style?: Style }>`
|
|
7
|
+
border: 0px solid black;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
margin: ${({ style }) => (style && style.margin ? style.margin : '0px')};
|
|
12
|
+
border-bottom-color: ${({ style }) =>
|
|
13
|
+
style && style.borderBottomColor ? style.borderBottomColor : 'black'};
|
|
14
|
+
border-bottom-width: ${({ style }) =>
|
|
15
|
+
style && style.borderBottomWidth ? style.borderBottomWidth : '0px'};
|
|
16
|
+
border-radius: ${({ style }) =>
|
|
17
|
+
style && style.borderRadius && style.borderRadius};
|
|
18
|
+
overflow: ${({ style }) => style && style.overflow && style.overflow};
|
|
19
|
+
height: ${({ style }) => style && style.height && style.height};
|
|
20
|
+
width: ${({ style }) => style && style.width && style.width};
|
|
21
|
+
margin: 0px;
|
|
22
|
+
min-height: 0px;
|
|
23
|
+
min-width: 0px;
|
|
24
|
+
padding: 0px;
|
|
25
|
+
position: relative;
|
|
26
|
+
z-index: 0;
|
|
27
|
+
`;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import styleguide from '../Styleguide';
|
|
2
|
+
import { timesFontSizes, fontStyles } from './fonts';
|
|
3
|
+
import lineHeight from '../lineHeight';
|
|
4
|
+
|
|
5
|
+
export default ({
|
|
6
|
+
font,
|
|
7
|
+
fontSize
|
|
8
|
+
}: {
|
|
9
|
+
font: keyof typeof fontStyles;
|
|
10
|
+
fontSize: keyof typeof timesFontSizes;
|
|
11
|
+
}) => {
|
|
12
|
+
const styles = styleguide();
|
|
13
|
+
return {
|
|
14
|
+
fontFamily: styles.fonts[font],
|
|
15
|
+
fontSize: timesFontSizes[fontSize],
|
|
16
|
+
lineHeight: lineHeight({ font, fontSize })
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
articleHeadline: 45,
|
|
3
|
+
articleMeta: 15,
|
|
4
|
+
body: 18,
|
|
5
|
+
bodyMobile: 17,
|
|
6
|
+
button: 16,
|
|
7
|
+
caption: 13,
|
|
8
|
+
cardHeadline: 27,
|
|
9
|
+
cardMeta: 13,
|
|
10
|
+
cardMetaMobile: 12,
|
|
11
|
+
commentsGuidelines: 13,
|
|
12
|
+
commentsHeadline: 27,
|
|
13
|
+
credits: 9,
|
|
14
|
+
headline: 30,
|
|
15
|
+
imageOverlayTextSmall: 11,
|
|
16
|
+
infoTitle: 22,
|
|
17
|
+
keyFactsTitle: 24,
|
|
18
|
+
leadHeadline: 26,
|
|
19
|
+
link: 13,
|
|
20
|
+
meta: 14,
|
|
21
|
+
newsletterPuffLabel: 12,
|
|
22
|
+
newsletterPuffHeadline: 28,
|
|
23
|
+
newsletterPuffCopy: 15,
|
|
24
|
+
pageComponentHeadline: 25,
|
|
25
|
+
pageHeadline: 40,
|
|
26
|
+
pageHeadlineLarge: 50,
|
|
27
|
+
pagingMeta: 15,
|
|
28
|
+
puffLink: 11,
|
|
29
|
+
secondary: 16,
|
|
30
|
+
sliceHeadline: 32,
|
|
31
|
+
smallestHeadline: 20,
|
|
32
|
+
smallHeadline: 22,
|
|
33
|
+
strapline: 22,
|
|
34
|
+
teaser: 14,
|
|
35
|
+
tertiary: 15,
|
|
36
|
+
tileLeadHeadline: 35,
|
|
37
|
+
heading2Mobile: 25,
|
|
38
|
+
heading3Mobile: 22,
|
|
39
|
+
heading4Mobile: 19,
|
|
40
|
+
heading5Mobile: 17,
|
|
41
|
+
infoSubText: 18,
|
|
42
|
+
heading2: 28,
|
|
43
|
+
heading3: 24,
|
|
44
|
+
heading4: 20,
|
|
45
|
+
heading5: 19
|
|
46
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
body: 'TimesDigitalW04',
|
|
3
|
+
bodyRegular: 'TimesDigitalW04-Regular',
|
|
4
|
+
bodyRegularSmallCaps: 'TimesDigitalW04-RegularSC',
|
|
5
|
+
cultureMagazine: 'Flama-Bold',
|
|
6
|
+
dropCap: 'TimesModern-Regular',
|
|
7
|
+
headline: 'TimesModern-Bold',
|
|
8
|
+
headlineRegular: 'TimesModern-Regular',
|
|
9
|
+
stMagazine: 'Tiempos-Headline-Bold',
|
|
10
|
+
styleMagazine: 'CenturyGothic-Bold',
|
|
11
|
+
supporting: 'GillSansMTStd-Medium'
|
|
12
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { fonts } from '../Styleguide';
|
|
2
|
+
import { timesFontSizes as fontSizes } from '../fonts/fonts';
|
|
3
|
+
|
|
4
|
+
const styles: Record<string, Record<string, number | string>> = {
|
|
5
|
+
animationBox: {
|
|
6
|
+
backgroundColor: '#CCCCCC',
|
|
7
|
+
margin: 50,
|
|
8
|
+
padding: 100
|
|
9
|
+
},
|
|
10
|
+
box: {
|
|
11
|
+
height: 100,
|
|
12
|
+
marginBottom: 10
|
|
13
|
+
},
|
|
14
|
+
container: {
|
|
15
|
+
borderColor: '#DBDBDB',
|
|
16
|
+
borderWidth: 1,
|
|
17
|
+
margin: 20,
|
|
18
|
+
paddingBottom: 10,
|
|
19
|
+
width: 250
|
|
20
|
+
},
|
|
21
|
+
display: {
|
|
22
|
+
flexDirection: 'row',
|
|
23
|
+
flexWrap: 'wrap'
|
|
24
|
+
},
|
|
25
|
+
headline: {
|
|
26
|
+
fontSize: fontSizes.body,
|
|
27
|
+
fontWeight: 'bold',
|
|
28
|
+
marginBottom: 10
|
|
29
|
+
},
|
|
30
|
+
showoffFonts: {
|
|
31
|
+
fontSize: fontSizes.headline,
|
|
32
|
+
marginBottom: 20,
|
|
33
|
+
marginLeft: 20,
|
|
34
|
+
marginTop: 10
|
|
35
|
+
},
|
|
36
|
+
showoffFontsContainer: {
|
|
37
|
+
borderBottomColor: '#CCCCCC',
|
|
38
|
+
borderBottomWidth: 1,
|
|
39
|
+
margin: 20
|
|
40
|
+
},
|
|
41
|
+
subHeadline: {
|
|
42
|
+
fontSize: fontSizes.meta,
|
|
43
|
+
fontWeight: 'bold',
|
|
44
|
+
marginLeft: 10,
|
|
45
|
+
marginTop: 10
|
|
46
|
+
},
|
|
47
|
+
text: {
|
|
48
|
+
color: '#333333',
|
|
49
|
+
fontFamily: fonts.body,
|
|
50
|
+
fontSize: fontSizes.caption,
|
|
51
|
+
textAlign: 'center'
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default styles;
|