-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathShared.ts
101 lines (90 loc) · 2.36 KB
/
Shared.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { css } from '@emotion/react';
import { from, remSpace, space } from '@guardian/source/foundations';
import { SECTION_GAP } from '@/client/models/Style';
export const disableAutofillBackground = css`
:-webkit-autofill {
background-color: transparent !important;
box-shadow: 0 0 0 50px white inset;
}
:autofill {
background-color: transparent !important;
box-shadow: 0 0 0 50px white inset;
}
`;
// Fixed source divider expanding off the side of the container
export const divider = css`
width: 100%;
margin: ${remSpace[2]} 0 -${remSpace[1]} 0;
background-color: var(--color-divider);
`;
export const errorContextLastTypeSpacing = css`
margin-bottom: 0;
&:last-child {
margin-bottom: ${remSpace[3]};
}
`;
export const errorContextSpacing = css`
margin: 0;
margin-top: ${space[2]}px;
`;
export const mainSectionStyles = css`
display: flex;
flex-direction: column;
gap: ${SECTION_GAP};
`;
type ButtonWidth = 'full' | 'half';
const sharedButtonStyles = (width: ButtonWidth = 'full') => css`
width: 100%;
${from.tablet} {
max-width: ${width === 'full' ? '100%' : '50%'};
}
margin: 0 auto;
justify-content: center;
:disabled {
cursor: not-allowed;
}
`;
export const primaryButtonStyles = (width: ButtonWidth = 'full') => css`
${sharedButtonStyles(width)}
background-color: var(--color-button-primary-background);
border-color: var(--color-button-primary-border);
color: var(--color-button-primary-text);
&:hover {
background-color: var(--color-button-primary-background-hover);
}
`;
export const secondaryButtonStyles = (width: ButtonWidth = 'full') => css`
${sharedButtonStyles(width)}
background-color: var(--color-button-secondary-background);
border-color: var(--color-button-secondary-border);
color: var(--color-button-secondary-text);
&:hover {
background-color: var(--color-button-secondary-background-hover);
}
`;
export const errorMessageStyles = css`
border-color: var(--color-alert-error);
color: var(--color-alert-error);
div {
color: var(--color-alert-error);
}
svg {
fill: var(--color-alert-error) !important;
}
a {
color: var(--color-alert-error);
}
`;
export const successMessageStyles = css`
border-color: var(--color-alert-success);
color: var(--color-alert-success);
div {
color: var(--color-alert-success);
}
svg {
fill: var(--color-alert-success) !important;
}
a {
color: var(--color-alert-success);
}
`;