@defra/flood-webchat 0.0.1-beta.26 → 0.0.1-beta.28
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/dist/client.js +256 -105
- package/dist/client.js.map +1 -1
- package/main.scss +10 -6
- package/package.json +1 -1
- package/src/client/components/availability/availability.jsx +9 -4
- package/src/client/components/availability/availability.scss +8 -134
- package/src/client/components/chat/chat.jsx +50 -51
- package/src/client/components/chat/chat.scss +113 -35
- package/src/client/components/errorSummary/error-summary.jsx +2 -2
- package/src/client/components/message/message.jsx +4 -4
- package/src/client/components/panel/panel-header.jsx +40 -11
- package/src/client/components/panel/panel.jsx +21 -4
- package/src/client/components/panel/panel.scss +62 -22
- package/src/client/components/screens/end-chat.jsx +6 -4
- package/src/client/components/screens/feedback.jsx +5 -5
- package/src/client/components/screens/pre-chat.jsx +45 -44
- package/src/client/components/screens/request-chat.jsx +74 -67
- package/src/client/components/screens/settings.jsx +39 -37
- package/src/client/hooks/useFocusedElements.js +12 -2
- package/src/client/lib/history.js +13 -0
- package/src/client/scss/_objects.scss +33 -0
- package/src/client/scss/_settings.scss +75 -0
- package/src/client/scss/_tools.scss +33 -0
- package/src/client/scss/_utilities.scss +25 -0
- package/src/client/store/AppProvider.jsx +39 -4
- package/src/client/store/actions-map.js +17 -1
- package/src/client/store/reducer.js +2 -0
|
@@ -1,27 +1,51 @@
|
|
|
1
1
|
.wc-panel {
|
|
2
2
|
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
3
|
position: fixed;
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
flex-wrap: nowrap;
|
|
5
|
+
z-index: 999;
|
|
7
6
|
top: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
8
9
|
left: 0;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@include mq ($from: 'tablet') {
|
|
17
|
-
bottom: 0;
|
|
18
|
-
right: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
-webkit-overflow-scrolling: touch;
|
|
13
|
+
touch-action: pan-x pan-y;
|
|
14
|
+
background-color: #ffffff;
|
|
15
|
+
@include mq ($from: tablet) {
|
|
19
16
|
top: auto;
|
|
20
17
|
left: auto;
|
|
21
18
|
width: 400px;
|
|
22
19
|
height: 540px;
|
|
23
|
-
margin-bottom: 10px;
|
|
24
20
|
margin-right: 10px;
|
|
21
|
+
margin-bottom: 10px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:focus {
|
|
25
|
+
outline: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:focus.wc-focus-visible::after {
|
|
29
|
+
@include focus($glow: 5px, $strong: 2px, $background: 0, $inset: 0);
|
|
30
|
+
left: 4px;
|
|
31
|
+
right: 4px;
|
|
32
|
+
top: 4px;
|
|
33
|
+
bottom: 4px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__inner {
|
|
37
|
+
position: relative;
|
|
38
|
+
flex: 0 0 100%;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-wrap: nowrap;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
background-color: transparent;
|
|
43
|
+
border: 0;
|
|
44
|
+
outline: 0;
|
|
45
|
+
@include mq ($from: tablet) {
|
|
46
|
+
border: 1px solid govuk-colour('black');
|
|
47
|
+
}
|
|
48
|
+
box-sizing: border-box;
|
|
25
49
|
}
|
|
26
50
|
}
|
|
27
51
|
|
|
@@ -30,43 +54,59 @@
|
|
|
30
54
|
flex-direction: row;
|
|
31
55
|
align-items: center;
|
|
32
56
|
background-color: govuk-colour('black');
|
|
57
|
+
border-bottom: 1px solid govuk-colour('black');
|
|
58
|
+
padding: 3px;
|
|
33
59
|
|
|
34
60
|
&__link {
|
|
35
61
|
margin: 0 govuk-spacing(2);
|
|
36
62
|
}
|
|
37
63
|
|
|
38
64
|
&__title {
|
|
39
|
-
|
|
65
|
+
@extend %govuk-heading-s;
|
|
66
|
+
font-size: 19px;
|
|
67
|
+
padding: 0 0 0 10px;
|
|
68
|
+
@include mq ($from: tablet) {
|
|
69
|
+
padding-left: 7px;
|
|
70
|
+
}
|
|
40
71
|
color: govuk-colour('white');
|
|
41
72
|
margin-bottom: 0;
|
|
42
73
|
}
|
|
43
74
|
|
|
44
75
|
&__close,
|
|
45
|
-
&__hide
|
|
76
|
+
&__hide,
|
|
77
|
+
&__back {
|
|
46
78
|
display: flex;
|
|
47
79
|
justify-content: center;
|
|
48
80
|
color: govuk-colour('white');
|
|
49
81
|
background: none;
|
|
50
82
|
border: 0;
|
|
51
|
-
padding:
|
|
83
|
+
padding: 7px;
|
|
52
84
|
margin: 0 0 0 auto;
|
|
53
85
|
cursor: pointer;
|
|
54
86
|
|
|
55
87
|
&:focus {
|
|
56
|
-
|
|
88
|
+
outline: 3px solid $govuk-focus-colour;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&__back {
|
|
93
|
+
margin: 0;
|
|
94
|
+
display: flex;
|
|
95
|
+
|
|
96
|
+
@include mq ($from: 'tablet') {
|
|
97
|
+
display: none
|
|
57
98
|
}
|
|
58
99
|
}
|
|
59
100
|
}
|
|
60
101
|
|
|
61
102
|
.wc-body {
|
|
62
|
-
|
|
63
|
-
|
|
103
|
+
font-size: 16px;
|
|
64
104
|
flex: 1;
|
|
65
105
|
position: relative;
|
|
66
106
|
overflow-y: auto;
|
|
67
107
|
overscroll-behavior: contain;
|
|
68
108
|
}
|
|
69
109
|
|
|
70
|
-
.wc-
|
|
71
|
-
|
|
110
|
+
.wc-content {
|
|
111
|
+
padding: 20px 15px;
|
|
72
112
|
}
|
|
@@ -26,10 +26,12 @@ export function EndChat ({ onChatScreen, onEndChatConfirm }) {
|
|
|
26
26
|
<>
|
|
27
27
|
<PanelHeader />
|
|
28
28
|
<div className='wc-body'>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
29
|
+
<div className='wc-content'>
|
|
30
|
+
<h3 className='wc-heading' aria-live='polite'>Are you sure you want to end the chat?</h3>
|
|
31
|
+
<div className='govuk-button-group'>
|
|
32
|
+
<a href='#endChat' role='button' className='wc-button govuk-button' data-module='govuk-button' id='confirmEndChat' onClick={confirmEndChat}>Yes, end chat</a>
|
|
33
|
+
<a href='#resumeChat' role='button' className='wc-link govuk-link' onClick={onChatScreen}>No, resume chat</a>
|
|
34
|
+
</div>
|
|
33
35
|
</div>
|
|
34
36
|
</div>
|
|
35
37
|
</>
|
|
@@ -11,11 +11,11 @@ export function Feedback ({ onCancel }) {
|
|
|
11
11
|
<PanelHeader />
|
|
12
12
|
|
|
13
13
|
<div className='wc-body'>
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<a id='feedback-cancel' href='#' data-module='govuk-button' role='button' onClick={feedbackCancel}>Close</a>
|
|
14
|
+
<div className='wc-content'>
|
|
15
|
+
<h3 id='wc-subtitle' className='wc-heading'>Give Feedback on Floodline webchat</h3>
|
|
16
|
+
<p>Please note we’re unable to respond to feedback.</p>
|
|
17
|
+
<p><a className='govuk-link' href='#' target='_blank' rel='noreferrer'>Feedback Link</a></p>
|
|
18
|
+
<p><a id='feedback-cancel' className='wc-link govuk-link' href='#' data-module='govuk-button' role='button' onClick={feedbackCancel}>Close</a></p>
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
21
21
|
</>
|
|
@@ -7,54 +7,55 @@ export function PreChat ({ onContinue }) {
|
|
|
7
7
|
<PanelHeader />
|
|
8
8
|
|
|
9
9
|
<div className='wc-body'>
|
|
10
|
-
<
|
|
11
|
-
|
|
10
|
+
<div className='wc-content'>
|
|
11
|
+
<h3 className='wc-heading' aria-live='polite'>What you can use webchat for</h3>
|
|
12
|
+
<p>Webchat lets you talk directly to a Floodline adviser.</p>
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
<p>You can use webchat to get:</p>
|
|
15
|
+
<ul className='wc-list'>
|
|
16
|
+
<li>current flood warnings and alerts in your area</li>
|
|
17
|
+
<li>information on the flood warning service</li>
|
|
18
|
+
<li>advice on what to do before, during and after a flood</li>
|
|
19
|
+
</ul>
|
|
20
|
+
<p>
|
|
21
|
+
There are other ways to
|
|
22
|
+
<a className='govuk-link' href='https://www.gov.uk/sign-up-for-flood-warnings' target='_blank' rel='noreferrer'>
|
|
23
|
+
sign up for flood warnings
|
|
24
|
+
</a>
|
|
25
|
+
and
|
|
26
|
+
<a className='govuk-link' href='https://www.fws.environment-agency.gov.uk/app/olr/login' target='_blank' rel='noreferrer'>
|
|
27
|
+
manage your flood warnings account
|
|
28
|
+
</a>.
|
|
29
|
+
</p>
|
|
30
|
+
<p>
|
|
31
|
+
Do not use webchat to
|
|
32
|
+
<a
|
|
33
|
+
className='govuk-link'
|
|
34
|
+
href='https://www.gov.uk/report-flood-cause'
|
|
35
|
+
target='_blank'
|
|
36
|
+
rel='noreferrer'
|
|
37
|
+
>
|
|
38
|
+
report a flood
|
|
39
|
+
</a>.
|
|
40
|
+
</p>
|
|
19
41
|
|
|
20
|
-
|
|
21
|
-
There are other ways to
|
|
22
|
-
<a className='govuk-link' href='https://www.gov.uk/sign-up-for-flood-warnings' target='_blank' rel='noreferrer'>
|
|
23
|
-
sign up for flood warnings
|
|
24
|
-
</a>
|
|
25
|
-
and
|
|
26
|
-
<a className='govuk-link' href='https://www.fws.environment-agency.gov.uk/app/olr/login' target='_blank' rel='noreferrer'>
|
|
27
|
-
manage your flood warnings account
|
|
28
|
-
</a>.
|
|
29
|
-
</p>
|
|
30
|
-
<p className='govuk-body-s'>
|
|
31
|
-
Do not use webchat to
|
|
32
|
-
<a
|
|
33
|
-
className='govuk-link'
|
|
34
|
-
href='https://www.gov.uk/report-flood-cause'
|
|
35
|
-
target='_blank'
|
|
36
|
-
rel='noreferrer'
|
|
37
|
-
>
|
|
38
|
-
report a flood
|
|
39
|
-
</a>.
|
|
40
|
-
</p>
|
|
42
|
+
<button className='govuk-button wc-button govuk-!-margin-top-1' data-module='govuk-button' onClick={onContinue}>Continue</button>
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
<h3 className='wc-heading'>Other flood information</h3>
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</p>
|
|
46
|
+
<p>Call Floodline for all other flood and flood warning information.</p>
|
|
47
|
+
<p>
|
|
48
|
+
<strong>Floodline helpline</strong>
|
|
49
|
+
<br />
|
|
50
|
+
Telephone: 0345 988 1188
|
|
51
|
+
<br />
|
|
52
|
+
Textphone: 0345 602 6340
|
|
53
|
+
<br />
|
|
54
|
+
Open 24 hours a day, 7 days a week
|
|
55
|
+
<br />
|
|
56
|
+
<a className='govuk-link' href='https://gov.uk/call-charges' target='_blank' rel='noreferrer'>Find out more about call charges</a>
|
|
57
|
+
</p>
|
|
58
|
+
</div>
|
|
58
59
|
</div>
|
|
59
60
|
</>
|
|
60
61
|
)
|
|
@@ -86,80 +86,87 @@ export function RequestChat ({ onPreChatScreen }) {
|
|
|
86
86
|
<PanelHeader />
|
|
87
87
|
|
|
88
88
|
<div className='wc-body'>
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{errors.name && (
|
|
105
|
-
<p className='govuk-error-message'>
|
|
106
|
-
<span className='govuk-visually-hidden'>Error:</span> {errors.name}
|
|
107
|
-
</p>
|
|
108
|
-
)}
|
|
109
|
-
<input
|
|
110
|
-
ref={nameRef}
|
|
111
|
-
className={classnames('govuk-input', errors.name && 'govuk-input--error')}
|
|
112
|
-
id='wc-name'
|
|
113
|
-
name='name'
|
|
114
|
-
type='text'
|
|
115
|
-
data-testid='request-chat-user-name'
|
|
116
|
-
/>
|
|
117
|
-
</div>
|
|
118
|
-
|
|
119
|
-
<div className='govuk-character-count' data-module='govuk-character-count' data-maxlength='500'>
|
|
120
|
-
<div className={classnames('govuk-form-group', errors.question && 'govuk-form-group--error')}>
|
|
121
|
-
<label className='govuk-label' htmlFor='wc-question'>
|
|
122
|
-
Your question
|
|
89
|
+
<div className='wc-content'>
|
|
90
|
+
<a href='#' className='wc-back-link govuk-back-link' onClick={onPreChatScreen}>
|
|
91
|
+
What you can use webchat for
|
|
92
|
+
</a>
|
|
93
|
+
|
|
94
|
+
<ErrorSummary errors={errors} />
|
|
95
|
+
|
|
96
|
+
<h3 className='wc-heading' aria-live='polite'>
|
|
97
|
+
Your name and question
|
|
98
|
+
</h3>
|
|
99
|
+
|
|
100
|
+
<form>
|
|
101
|
+
<div className={classnames('wc-form-group', 'govuk-form-group', errors.name && 'govuk-form-group--error')}>
|
|
102
|
+
<label className='wc-label govuk-label' htmlFor='wc-name'>
|
|
103
|
+
Your name
|
|
123
104
|
</label>
|
|
124
|
-
{errors.
|
|
105
|
+
{errors.name && (
|
|
125
106
|
<p className='govuk-error-message'>
|
|
126
|
-
<span className='govuk-visually-hidden'>Error:</span>
|
|
127
|
-
{errors.question}
|
|
107
|
+
<span className='govuk-visually-hidden'>Error:</span> {errors.name}
|
|
128
108
|
</p>
|
|
129
109
|
)}
|
|
130
|
-
<
|
|
131
|
-
ref={
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
className={classnames('govuk-textarea', 'govuk-js-character-count', !isQuestionLengthValid || errors.question ? 'govuk-textarea--error' : '')}
|
|
138
|
-
data-testid='request-chat-user-question'
|
|
110
|
+
<input
|
|
111
|
+
ref={nameRef}
|
|
112
|
+
className={classnames('wc-input', 'govuk-input', errors.name && 'govuk-input--error')}
|
|
113
|
+
id='wc-name'
|
|
114
|
+
name='name'
|
|
115
|
+
type='text'
|
|
116
|
+
data-testid='request-chat-user-name'
|
|
139
117
|
/>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
<div className='govuk-
|
|
144
|
-
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<div className='wc-form-group govuk-character-count' data-module='govuk-character-count' data-maxlength='500'>
|
|
121
|
+
<div className={classnames('govuk-form-group', errors.question && 'govuk-form-group--error')}>
|
|
122
|
+
<label className='wc-label govuk-label' htmlFor='wc-question'>
|
|
123
|
+
Your question
|
|
124
|
+
</label>
|
|
125
|
+
{errors.question && (
|
|
126
|
+
<p className='govuk-error-message'>
|
|
127
|
+
<span className='govuk-visually-hidden'>Error:</span>
|
|
128
|
+
{errors.question}
|
|
129
|
+
</p>
|
|
130
|
+
)}
|
|
131
|
+
<textarea
|
|
132
|
+
ref={questionRef}
|
|
133
|
+
id='wc-question'
|
|
134
|
+
name='question'
|
|
135
|
+
rows='5'
|
|
136
|
+
aria-describedby='wc-question-info'
|
|
137
|
+
onChange={onQuestionChange}
|
|
138
|
+
className={classnames('wc-textarea', 'govuk-textarea', 'govuk-js-character-count', !isQuestionLengthValid || errors.question ? 'govuk-textarea--error' : '')}
|
|
139
|
+
data-testid='request-chat-user-question'
|
|
140
|
+
/>
|
|
141
|
+
<div
|
|
142
|
+
id='wc-question-info'
|
|
143
|
+
className='wc-hint govuk-hint govuk-char-count__msg'
|
|
144
|
+
style={{ color: `${!isQuestionLengthValid ? '#d4351c' : ''}` }}
|
|
145
|
+
aria-hidden='true'
|
|
146
|
+
>
|
|
147
|
+
{questionHint}
|
|
148
|
+
</div>
|
|
149
|
+
<div className='govuk-character-count__sr-status govuk-visually-hidden' aria-live='polite'>
|
|
150
|
+
{questionHint}
|
|
151
|
+
</div>
|
|
145
152
|
</div>
|
|
146
153
|
</div>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
</
|
|
162
|
-
</
|
|
154
|
+
|
|
155
|
+
<div className='wc-inset-text govuk-inset-text'>
|
|
156
|
+
By selecting 'Request chat' you agree to the terms of our
|
|
157
|
+
<a href='https://check-for-flooding.service.gov.uk/privacy-notice' target='_blank' rel='noreferrer' className='govuk-link'>privacy notice</a>.
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<button
|
|
161
|
+
className='wc-button govuk-button govuk-!-margin-top-1'
|
|
162
|
+
data-module='govuk-button'
|
|
163
|
+
onClick={onRequestChat}
|
|
164
|
+
disabled={isButtonDisabled}
|
|
165
|
+
>
|
|
166
|
+
{buttonLabel}
|
|
167
|
+
</button>
|
|
168
|
+
</form>
|
|
169
|
+
</div>
|
|
163
170
|
</div>
|
|
164
171
|
</>
|
|
165
172
|
)
|
|
@@ -21,45 +21,47 @@ export function Settings ({ onCancel }) {
|
|
|
21
21
|
<PanelHeader />
|
|
22
22
|
|
|
23
23
|
<div className='wc-body'>
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<div className='govuk-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
<div className='wc-content'>
|
|
25
|
+
<fieldset className='govuk-fieldset govuk-!-margin-bottom-4'>
|
|
26
|
+
<legend className='govuk-fieldset__legend govuk-fieldset__legend'>
|
|
27
|
+
<h3 id='wc-subtitle' className='wc-heading'>Change settings</h3>
|
|
28
|
+
</legend>
|
|
29
|
+
<div className='govuk-checkboxes govuk-checkboxes--small' data-module='govuk-checkboxes'>
|
|
30
|
+
<div className='govuk-checkboxes__item'>
|
|
31
|
+
<input
|
|
32
|
+
id='audio'
|
|
33
|
+
name='audio'
|
|
34
|
+
type='checkbox'
|
|
35
|
+
value='audio'
|
|
36
|
+
className='govuk-checkboxes__input'
|
|
37
|
+
defaultChecked={optionAudio}
|
|
38
|
+
onChange={() => setOptionAudio(!optionAudio)}
|
|
39
|
+
/>
|
|
40
|
+
<label className='wc-label govuk-label govuk-checkboxes__label' htmlFor='audio'>
|
|
41
|
+
Play a sound when receiving a new message
|
|
42
|
+
</label>
|
|
43
|
+
</div>
|
|
44
|
+
<div className='govuk-checkboxes__item'>
|
|
45
|
+
<input
|
|
46
|
+
id='scroll'
|
|
47
|
+
name='scroll'
|
|
48
|
+
type='checkbox'
|
|
49
|
+
value='scroll'
|
|
50
|
+
className='govuk-checkboxes__input'
|
|
51
|
+
defaultChecked={optionScroll}
|
|
52
|
+
onChange={() => setOptionScroll(!optionScroll)}
|
|
53
|
+
/>
|
|
54
|
+
<label className='wc-label govuk-label govuk-checkboxes__label' htmlFor='scroll'>
|
|
55
|
+
Scroll automatically to a new message
|
|
56
|
+
</label>
|
|
57
|
+
</div>
|
|
42
58
|
</div>
|
|
43
|
-
|
|
44
|
-
<input
|
|
45
|
-
id='scroll'
|
|
46
|
-
name='scroll'
|
|
47
|
-
type='checkbox'
|
|
48
|
-
value='scroll'
|
|
49
|
-
className='govuk-checkboxes__input'
|
|
50
|
-
defaultChecked={optionScroll}
|
|
51
|
-
onChange={() => setOptionScroll(!optionScroll)}
|
|
52
|
-
/>
|
|
53
|
-
<label className='govuk-label govuk-checkboxes__label govuk-!-font-size-16' htmlFor='scroll'>
|
|
54
|
-
Scroll automatically to a new message
|
|
55
|
-
</label>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
</fieldset>
|
|
59
|
+
</fieldset>
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
<div className='govuk-button-group'>
|
|
62
|
+
<a id='settings-save' href='#' className='wc-button govuk-button' data-module='govuk-button' onClick={onSave}>Save</a>
|
|
63
|
+
<a id='settings-cancel' href='#' className='wc-link govuk-link' data-module='govuk-button' onClick={onCancel}>Cancel</a>
|
|
64
|
+
</div>
|
|
63
65
|
</div>
|
|
64
66
|
</div>
|
|
65
67
|
</>
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback } from 'react'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const ariaHidden = 'aria-hidden'
|
|
4
|
+
const dataWcInert = 'data-wc-inert'
|
|
5
|
+
|
|
6
|
+
const setAriaHidden = isInert => {
|
|
4
7
|
for (const node of document.body.children) {
|
|
5
8
|
if (node.id !== 'wc-panel') {
|
|
6
|
-
|
|
9
|
+
// We only want to toggle elements that aren't already inert
|
|
10
|
+
if (isInert && !node.getAttribute(ariaHidden)) {
|
|
11
|
+
node.setAttribute(ariaHidden, 'true')
|
|
12
|
+
node.setAttribute(dataWcInert, '')
|
|
13
|
+
} else if (node.hasAttribute(dataWcInert)) {
|
|
14
|
+
node.removeAttribute(ariaHidden)
|
|
15
|
+
node.removeAttribute(dataWcInert)
|
|
16
|
+
}
|
|
7
17
|
}
|
|
8
18
|
}
|
|
9
19
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const historyPushState = () => {
|
|
2
|
+
const url = window.location.href.split('#')[0]
|
|
3
|
+
window.history.pushState({ history: true }, null, `${url}#webchat`)
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const historyReplaceState = () => {
|
|
7
|
+
if (window.history.state?.history) {
|
|
8
|
+
window.history.back()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const url = window.location.href.split('#')[0]
|
|
12
|
+
window.history.replaceState(null, null, url)
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
%wc-link-button {
|
|
2
|
+
@extend %govuk-link;
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-block;
|
|
5
|
+
font-size: 16px;
|
|
6
|
+
color: govuk-colour('black');
|
|
7
|
+
|
|
8
|
+
&:hover {
|
|
9
|
+
color: govuk-colour('black');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&:visited:not(:hover):not(:focus) {
|
|
13
|
+
color: govuk-colour('black');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&:active {
|
|
17
|
+
color: govuk-colour('black');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&:focus {
|
|
21
|
+
box-shadow: none;
|
|
22
|
+
background-color: transparent;
|
|
23
|
+
text-decoration: underline;
|
|
24
|
+
color: govuk-colour('black');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:focus-visible {
|
|
28
|
+
background-color: $govuk-focus-colour;
|
|
29
|
+
box-shadow: 0 -2px $govuk-focus-colour, 0 4px govuk-colour('black');
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
color: govuk-colour('black');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.wc-heading {
|
|
2
|
+
@extend %govuk-heading-m;
|
|
3
|
+
font-size: 19px;
|
|
4
|
+
margin-bottom: 15px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.wc-list {
|
|
8
|
+
@extend %govuk-list;
|
|
9
|
+
@extend %govuk-list--bullet;
|
|
10
|
+
font-size: 16px;
|
|
11
|
+
line-height: 1.25;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.wc-body p {
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
line-height: 1.25;
|
|
17
|
+
margin-bottom: 15px;
|
|
18
|
+
@extend %govuk-body-s;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.wc-body .govuk-error-message {
|
|
22
|
+
color: govuk-colour('red');
|
|
23
|
+
font-weight: 700;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.wc-link,
|
|
27
|
+
.wc-button,
|
|
28
|
+
.govuk-button-group .wc-button,
|
|
29
|
+
.govuk-button-group .wc-link {
|
|
30
|
+
font-size: 16px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.wc-label {
|
|
34
|
+
font-size: 16px;
|
|
35
|
+
line-height: 1.25;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.wc-form-group {
|
|
39
|
+
margin-bottom: 15px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.wc-hint {
|
|
43
|
+
font-size: 16px;
|
|
44
|
+
line-height: 1.25;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.wc-inset-text {
|
|
48
|
+
margin: 0 0 20px;
|
|
49
|
+
padding: 5px 5px 5px 15px;
|
|
50
|
+
font-size: 16px;
|
|
51
|
+
border-left-width: 5px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.wc-error-summary__title {
|
|
55
|
+
font-size: 19px;
|
|
56
|
+
line-height: 1.25;
|
|
57
|
+
margin-bottom: 15px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.wc-error-summary__list,
|
|
61
|
+
.wc-error-message {
|
|
62
|
+
font-size: 16px;
|
|
63
|
+
line-height: 1.25;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.wc-input, .wc-textarea {
|
|
67
|
+
font-size: 16px;
|
|
68
|
+
line-height: 1.25;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.wc-back-link {
|
|
72
|
+
font-size: 16px;
|
|
73
|
+
line-height: 1.25;
|
|
74
|
+
margin: 0 0 25px;
|
|
75
|
+
}
|