newspack-components 4.1.0 → 4.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/colors/colors.module.scss +1 -1
- package/dist/cjs/action-card/index.js +21 -12
- package/dist/cjs/action-card/style.scss +32 -14
- package/dist/cjs/autocomplete-tokenfield/index.js +2 -2
- package/dist/cjs/autocomplete-with-latest-posts/index.js +289 -0
- package/dist/cjs/autocomplete-with-latest-posts/style.scss +150 -0
- package/dist/cjs/badge/index.js +32 -0
- package/dist/cjs/badge/style.scss +36 -0
- package/dist/cjs/button/index.js +2 -0
- package/dist/cjs/card/core-card.js +141 -0
- package/dist/cjs/card/index.js +33 -0
- package/dist/cjs/card/style-core.scss +227 -0
- package/dist/cjs/card/style.scss +2 -2
- package/dist/cjs/card-settings-group/index.js +49 -0
- package/dist/cjs/card-settings-group/style.scss +33 -0
- package/dist/cjs/card-sortable-list/index.js +390 -0
- package/dist/cjs/card-sortable-list/style.scss +48 -0
- package/dist/cjs/confirm-dialog/index.js +59 -0
- package/dist/cjs/divider/index.js +42 -0
- package/dist/cjs/divider/style.scss +51 -0
- package/dist/cjs/form-token-field/style.scss +0 -5
- package/dist/cjs/grid/index.js +2 -1
- package/dist/cjs/grid/style.scss +63 -9
- package/dist/cjs/index.js +42 -0
- package/dist/cjs/modal/index.js +11 -4
- package/dist/cjs/modal/style.scss +43 -13
- package/dist/cjs/newspack-icon/style.scss +5 -3
- package/dist/cjs/popover/style.scss +1 -1
- package/dist/cjs/section-header/index.js +76 -17
- package/dist/cjs/section-header/style.scss +109 -4
- package/dist/cjs/style.scss +2 -0
- package/dist/cjs/waiting/index.js +3 -1
- package/dist/cjs/waiting/style.scss +4 -0
- package/dist/cjs/web-preview/index.js +98 -39
- package/dist/cjs/web-preview/style.scss +20 -53
- package/dist/cjs/with-wizard/index.js +1 -1
- package/dist/cjs/with-wizard/style.scss +24 -6
- package/dist/cjs/with-wizard-screen/style.scss +39 -10
- package/dist/cjs/wizard/components/WizardSnackbar.js +70 -0
- package/dist/cjs/wizard/components/style.scss +48 -0
- package/dist/cjs/wizard/index.js +97 -16
- package/dist/cjs/wizard/store/index.js +46 -0
- package/dist/esm/action-card/index.js +21 -12
- package/dist/esm/action-card/style.scss +32 -14
- package/dist/esm/autocomplete-tokenfield/index.js +2 -2
- package/dist/esm/autocomplete-with-latest-posts/index.js +281 -0
- package/dist/esm/autocomplete-with-latest-posts/style.scss +150 -0
- package/dist/esm/badge/index.js +24 -0
- package/dist/esm/badge/style.scss +36 -0
- package/dist/esm/button/index.js +2 -0
- package/dist/esm/card/core-card.js +133 -0
- package/dist/esm/card/index.js +33 -0
- package/dist/esm/card/style-core.scss +227 -0
- package/dist/esm/card/style.scss +2 -2
- package/dist/esm/card-settings-group/index.js +42 -0
- package/dist/esm/card-settings-group/style.scss +33 -0
- package/dist/esm/card-sortable-list/index.js +381 -0
- package/dist/esm/card-sortable-list/style.scss +48 -0
- package/dist/esm/confirm-dialog/index.js +49 -0
- package/dist/esm/divider/index.js +34 -0
- package/dist/esm/divider/style.scss +51 -0
- package/dist/esm/form-token-field/style.scss +0 -5
- package/dist/esm/grid/index.js +2 -1
- package/dist/esm/grid/style.scss +63 -9
- package/dist/esm/index.js +6 -0
- package/dist/esm/modal/index.js +11 -4
- package/dist/esm/modal/style.scss +43 -13
- package/dist/esm/newspack-icon/style.scss +5 -3
- package/dist/esm/popover/style.scss +1 -1
- package/dist/esm/section-header/index.js +75 -18
- package/dist/esm/section-header/style.scss +109 -4
- package/dist/esm/style.scss +2 -0
- package/dist/esm/waiting/index.js +3 -1
- package/dist/esm/waiting/style.scss +4 -0
- package/dist/esm/web-preview/index.js +101 -42
- package/dist/esm/web-preview/style.scss +20 -53
- package/dist/esm/with-wizard/index.js +1 -1
- package/dist/esm/with-wizard/style.scss +24 -6
- package/dist/esm/with-wizard-screen/style.scss +39 -10
- package/dist/esm/wizard/components/WizardSnackbar.js +64 -0
- package/dist/esm/wizard/components/style.scss +48 -0
- package/dist/esm/wizard/index.js +101 -20
- package/dist/esm/wizard/store/index.js +46 -0
- package/package.json +5 -6
- package/shared/author-context.js +26 -0
- package/shared/hooks/use-coauthors.js +220 -0
- package/shared/hooks/use-coauthors.test.js +624 -0
- package/shared/hooks/use-custom-byline.js +47 -0
- package/shared/hooks/use-custom-byline.test.js +133 -0
- package/shared/scss/_mixins.scss +46 -0
- package/src/action-card/action-card.d.ts +7 -3
- package/src/action-card/index.js +24 -11
- package/src/action-card/style.scss +32 -14
- package/src/autocomplete-tokenfield/index.js +2 -2
- package/src/autocomplete-with-latest-posts/index.js +290 -0
- package/src/autocomplete-with-latest-posts/style.scss +150 -0
- package/src/badge/index.tsx +24 -0
- package/src/badge/style.scss +36 -0
- package/src/button/index.tsx +3 -2
- package/src/card/core-card.js +147 -0
- package/src/card/index.js +39 -1
- package/src/card/style-core.scss +227 -0
- package/src/card/style.scss +2 -2
- package/src/card-settings-group/README.md +43 -0
- package/src/card-settings-group/index.tsx +53 -0
- package/src/card-settings-group/style.scss +33 -0
- package/src/card-sortable-list/README.md +51 -0
- package/src/card-sortable-list/index.tsx +412 -0
- package/src/card-sortable-list/style.scss +48 -0
- package/src/confirm-dialog/index.tsx +64 -0
- package/src/divider/README.md +25 -0
- package/src/divider/index.js +31 -0
- package/src/divider/style.scss +51 -0
- package/src/form-token-field/style.scss +0 -5
- package/src/grid/index.tsx +2 -1
- package/src/grid/style.scss +63 -9
- package/src/index.js +6 -0
- package/src/modal/index.js +12 -3
- package/src/modal/style.scss +43 -13
- package/src/newspack-icon/style.scss +5 -3
- package/src/popover/style.scss +1 -1
- package/src/section-header/index.js +72 -13
- package/src/section-header/style.scss +109 -4
- package/src/style.scss +2 -0
- package/src/waiting/index.js +2 -1
- package/src/waiting/style.scss +4 -0
- package/src/web-preview/index.js +90 -35
- package/src/web-preview/style.scss +20 -53
- package/src/with-wizard/index.js +1 -1
- package/src/with-wizard/style.scss +24 -6
- package/src/with-wizard-screen/style.scss +39 -10
- package/src/wizard/components/WizardSnackbar.js +58 -0
- package/src/wizard/components/style.scss +48 -0
- package/src/wizard/index.js +108 -14
- package/src/wizard/store/index.js +26 -0
package/src/web-preview/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Component, createRef, Fragment, createPortal } from '@wordpress/element';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
7
|
-
import { Button,
|
|
6
|
+
import { close, desktop, mobile, tablet, check } from '@wordpress/icons';
|
|
7
|
+
import { Button, DropdownMenu, MenuItem } from '@wordpress/components';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies.
|
|
@@ -48,21 +48,55 @@ class WebPreview extends Component {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* Add or remove applicable body classes
|
|
51
|
+
* Add or remove applicable body classes and keyboard event listeners
|
|
52
52
|
*/
|
|
53
|
-
componentDidUpdate() {
|
|
53
|
+
componentDidUpdate( prevProps, prevState ) {
|
|
54
54
|
if ( this.state.isPreviewVisible === true ) {
|
|
55
55
|
document.body.classList.add( 'newspack-web-preview--open' );
|
|
56
|
+
if ( prevState.isPreviewVisible === false ) {
|
|
57
|
+
// Add event listener when modal opens
|
|
58
|
+
document.addEventListener( 'keydown', this.handleKeyDown );
|
|
59
|
+
}
|
|
56
60
|
} else {
|
|
57
61
|
document.body.classList.remove( 'newspack-web-preview--open' );
|
|
62
|
+
if ( prevState.isPreviewVisible === true ) {
|
|
63
|
+
// Remove event listener when modal closes
|
|
64
|
+
document.removeEventListener( 'keydown', this.handleKeyDown );
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
67
|
}
|
|
60
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Clean up event listeners on unmount
|
|
71
|
+
*/
|
|
72
|
+
componentWillUnmount() {
|
|
73
|
+
document.removeEventListener( 'keydown', this.handleKeyDown );
|
|
74
|
+
document.body.classList.remove( 'newspack-web-preview--open' );
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Handle keyboard events
|
|
79
|
+
*/
|
|
80
|
+
handleKeyDown = event => {
|
|
81
|
+
if ( event.key === 'Escape' && this.state.isPreviewVisible ) {
|
|
82
|
+
this.closePreview();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Close the preview modal
|
|
88
|
+
*/
|
|
89
|
+
closePreview = () => {
|
|
90
|
+
const { onClose = () => {} } = this.props;
|
|
91
|
+
onClose();
|
|
92
|
+
this.setState( { isPreviewVisible: false, loaded: false } );
|
|
93
|
+
};
|
|
94
|
+
|
|
61
95
|
/**
|
|
62
96
|
* Create JSX for the modal
|
|
63
97
|
*/
|
|
64
98
|
getWebPreviewModal = () => {
|
|
65
|
-
const { beforeLoad = () => {},
|
|
99
|
+
const { beforeLoad = () => {}, url, title } = this.props;
|
|
66
100
|
const { device, loaded, isPreviewVisible } = this.state;
|
|
67
101
|
|
|
68
102
|
if ( ! this.modalDOMElement || ! isPreviewVisible ) {
|
|
@@ -70,42 +104,63 @@ class WebPreview extends Component {
|
|
|
70
104
|
}
|
|
71
105
|
|
|
72
106
|
const classes = classnames( 'newspack-web-preview', device, loaded && 'is-loaded' );
|
|
107
|
+
let icon = mobile;
|
|
108
|
+
if ( device === 'desktop' ) {
|
|
109
|
+
icon = desktop;
|
|
110
|
+
} else if ( device === 'tablet' ) {
|
|
111
|
+
icon = tablet;
|
|
112
|
+
}
|
|
73
113
|
beforeLoad();
|
|
74
114
|
return createPortal(
|
|
75
115
|
<div className={ classes }>
|
|
76
116
|
<div className="newspack-web-preview__interior">
|
|
77
117
|
<div className="newspack-web-preview__toolbar">
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
icon={ desktop }
|
|
84
|
-
label={ __( 'Preview Desktop Size', 'newspack-plugin' ) }
|
|
85
|
-
/>
|
|
86
|
-
<Button
|
|
87
|
-
onClick={ () => this.setState( { device: 'tablet' } ) }
|
|
88
|
-
variant={ 'tablet' === device && 'primary' }
|
|
89
|
-
icon={ tablet }
|
|
90
|
-
label={ __( 'Preview Tablet Size', 'newspack-plugin' ) }
|
|
91
|
-
/>
|
|
92
|
-
<Button
|
|
93
|
-
onClick={ () => this.setState( { device: 'phone' } ) }
|
|
94
|
-
variant={ 'phone' === device && 'primary' }
|
|
95
|
-
icon={ mobile }
|
|
96
|
-
label={ __( 'Preview Phone Size', 'newspack-plugin' ) }
|
|
97
|
-
/>
|
|
98
|
-
</ButtonGroup>
|
|
99
|
-
</div>
|
|
118
|
+
{ title && (
|
|
119
|
+
<div className="newspack-web-preview__toolbar-left">
|
|
120
|
+
<h3>{ title }</h3>
|
|
121
|
+
</div>
|
|
122
|
+
) }
|
|
100
123
|
<div className="newspack-web-preview__toolbar-right">
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
124
|
+
<DropdownMenu icon={ icon } label={ __( 'Preview Size', 'newspack-plugin' ) }>
|
|
125
|
+
{ ( { onClose: onDropdownClose } ) => (
|
|
126
|
+
<>
|
|
127
|
+
<MenuItem
|
|
128
|
+
icon={ device === 'desktop' ? check : null }
|
|
129
|
+
role="menuitemradio"
|
|
130
|
+
isSelected={ device === 'desktop' }
|
|
131
|
+
onClick={ () => {
|
|
132
|
+
this.setState( { device: 'desktop' } );
|
|
133
|
+
onDropdownClose();
|
|
134
|
+
} }
|
|
135
|
+
>
|
|
136
|
+
{ __( 'Desktop', 'newspack-plugin' ) }
|
|
137
|
+
</MenuItem>
|
|
138
|
+
<MenuItem
|
|
139
|
+
icon={ device === 'tablet' ? check : null }
|
|
140
|
+
role="menuitemradio"
|
|
141
|
+
isSelected={ device === 'tablet' }
|
|
142
|
+
onClick={ () => {
|
|
143
|
+
this.setState( { device: 'tablet' } );
|
|
144
|
+
onDropdownClose();
|
|
145
|
+
} }
|
|
146
|
+
>
|
|
147
|
+
{ __( 'Tablet', 'newspack-plugin' ) }
|
|
148
|
+
</MenuItem>
|
|
149
|
+
<MenuItem
|
|
150
|
+
icon={ device === 'phone' ? check : null }
|
|
151
|
+
role="menuitemradio"
|
|
152
|
+
isSelected={ device === 'phone' }
|
|
153
|
+
onClick={ () => {
|
|
154
|
+
this.setState( { device: 'phone' } );
|
|
155
|
+
onDropdownClose();
|
|
156
|
+
} }
|
|
157
|
+
>
|
|
158
|
+
{ __( 'Phone', 'newspack-plugin' ) }
|
|
159
|
+
</MenuItem>
|
|
160
|
+
</>
|
|
161
|
+
) }
|
|
162
|
+
</DropdownMenu>
|
|
163
|
+
<Button onClick={ this.closePreview } icon={ close } label={ __( 'Close Preview', 'newspack-plugin' ) } />
|
|
109
164
|
</div>
|
|
110
165
|
</div>
|
|
111
166
|
<div className="newspack-web-preview__content">
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
--wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
|
|
14
14
|
--wp-admin-theme-color-darker-20: #{colors.$primary-800};
|
|
15
15
|
--wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
|
|
16
|
+
--wp-admin-theme-color-lighter-10: #{colors.$primary-000};
|
|
17
|
+
--wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
|
|
16
18
|
|
|
17
|
-
background:
|
|
19
|
+
background: color-mix(in srgb, colors.$neutral-1000, transparent 65%);
|
|
18
20
|
box-sizing: border-box;
|
|
19
21
|
height: 100%;
|
|
20
22
|
left: 0;
|
|
@@ -27,11 +29,11 @@
|
|
|
27
29
|
z-index: 99999;
|
|
28
30
|
|
|
29
31
|
&.phone iframe {
|
|
30
|
-
max-width:
|
|
32
|
+
max-width: 360px;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
&.tablet iframe {
|
|
34
|
-
max-width:
|
|
36
|
+
max-width: 780px;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
&.is-loaded iframe {
|
|
@@ -46,7 +48,7 @@
|
|
|
46
48
|
animation: appear-animation 125ms ease-in-out;
|
|
47
49
|
animation-fill-mode: forwards;
|
|
48
50
|
background: white;
|
|
49
|
-
border-radius:
|
|
51
|
+
border-radius: 8px;
|
|
50
52
|
overflow: hidden;
|
|
51
53
|
height: 100%;
|
|
52
54
|
width: 100%;
|
|
@@ -54,19 +56,18 @@
|
|
|
54
56
|
|
|
55
57
|
&__content {
|
|
56
58
|
background: wp-colors.$gray-100;
|
|
57
|
-
height: calc(100% -
|
|
59
|
+
height: calc(100% - 72px);
|
|
58
60
|
-webkit-overflow-scrolling: touch;
|
|
59
61
|
overflow-x: hidden;
|
|
60
62
|
width: 100%;
|
|
61
63
|
|
|
62
64
|
iframe {
|
|
63
|
-
background:
|
|
65
|
+
background: white;
|
|
64
66
|
display: block;
|
|
65
67
|
height: 100%;
|
|
66
68
|
margin: 0 auto;
|
|
67
69
|
max-width: 100%;
|
|
68
70
|
opacity: 0;
|
|
69
|
-
outline: 1px solid wp-colors.$gray-300;
|
|
70
71
|
padding: 0;
|
|
71
72
|
pointer-events: all;
|
|
72
73
|
transition: max-width 125ms ease-in-out, opacity 250ms ease-in-out;
|
|
@@ -85,62 +86,28 @@
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
&__toolbar {
|
|
89
|
+
align-items: center;
|
|
88
90
|
border-bottom: 1px solid wp-colors.$gray-300;
|
|
89
91
|
display: flex;
|
|
90
|
-
|
|
92
|
+
gap: 16px;
|
|
93
|
+
justify-content: space-between;
|
|
94
|
+
min-height: 71px;
|
|
95
|
+
padding: 12px 24px;
|
|
91
96
|
|
|
92
97
|
&-left {
|
|
93
|
-
|
|
98
|
+
display: flex;
|
|
94
99
|
|
|
95
|
-
|
|
96
|
-
display: flex;
|
|
100
|
+
h3 {
|
|
97
101
|
margin: 0;
|
|
98
102
|
}
|
|
99
|
-
|
|
100
|
-
.newspack-button {
|
|
101
|
-
display: none;
|
|
102
|
-
padding: 0 !important;
|
|
103
|
-
|
|
104
|
-
&.is-selected {
|
|
105
|
-
background: var(--wp-admin-theme-color);
|
|
106
|
-
color: white;
|
|
107
|
-
|
|
108
|
-
&:active,
|
|
109
|
-
&:focus,
|
|
110
|
-
&:hover {
|
|
111
|
-
box-shadow: none !important;
|
|
112
|
-
color: white;
|
|
113
|
-
outline: none;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
&:focus {
|
|
117
|
-
box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color), inset 0 0 0 3px white !important;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@media screen and ( min-width: 528px ) {
|
|
122
|
-
&.is-phone,
|
|
123
|
-
&.is-tablet {
|
|
124
|
-
display: flex;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
@media screen and ( min-width: 816px ) {
|
|
129
|
-
&.is-desktop {
|
|
130
|
-
display: flex;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
103
|
}
|
|
135
104
|
|
|
136
105
|
&-right {
|
|
137
|
-
display:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.newspack-button {
|
|
143
|
-
border-radius: 0 !important;
|
|
106
|
+
display: grid;
|
|
107
|
+
gap: 8px;
|
|
108
|
+
grid-template-columns: repeat(2, 1fr);
|
|
109
|
+
justify-self: end;
|
|
110
|
+
margin-left: auto;
|
|
144
111
|
}
|
|
145
112
|
}
|
|
146
113
|
}
|
package/src/with-wizard/index.js
CHANGED
|
@@ -279,7 +279,7 @@ export default function withWizard( WrappedComponent, requiredPlugins ) {
|
|
|
279
279
|
return (
|
|
280
280
|
message &&
|
|
281
281
|
callback && (
|
|
282
|
-
<Modal
|
|
282
|
+
<Modal size="small" hideTitle={ ! title } title={ title } onRequestClose={ () => this.setState( { confirmation: null } ) }>
|
|
283
283
|
<p>{ message }</p>
|
|
284
284
|
<Card buttonsCard noBorder className="justify-end">
|
|
285
285
|
<Button variant="secondary" onClick={ () => this.setState( { confirmation: null } ) }>
|
|
@@ -3,11 +3,21 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
6
|
+
@use "../../../colors/colors.module" as colors;
|
|
6
7
|
|
|
7
8
|
// Styling for full-page-react Wizards (ignoring admin-header-only wizards).
|
|
8
9
|
body.newspack-wizard-page:not(.newspack-admin-header) {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
--wp-admin-theme-color: #{colors.$primary-600};
|
|
11
|
+
--wp-admin-theme-color--rgb: #{colors.$primary-600--rgb};
|
|
12
|
+
--wp-admin-theme-color-darker-10: #{colors.$primary-700};
|
|
13
|
+
--wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
|
|
14
|
+
--wp-admin-theme-color-darker-20: #{colors.$primary-800};
|
|
15
|
+
--wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
|
|
16
|
+
--wp-admin-theme-color-lighter-10: #{colors.$primary-000};
|
|
17
|
+
--wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
|
|
18
|
+
--wp-components-color-accent: #{colors.$primary-600};
|
|
19
|
+
|
|
20
|
+
background: #{wp-colors.$white};
|
|
11
21
|
|
|
12
22
|
// Reset Padding
|
|
13
23
|
#wpcontent {
|
|
@@ -18,6 +28,14 @@ body.newspack-wizard-page:not(.newspack-admin-header) {
|
|
|
18
28
|
padding-bottom: 220px;
|
|
19
29
|
min-height: 100vh;
|
|
20
30
|
|
|
31
|
+
@media screen and ( min-width: 600px ) {
|
|
32
|
+
min-height: calc(100vh - 46px);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@media screen and ( min-width: 783px ) {
|
|
36
|
+
min-height: calc(100vh - 32px);
|
|
37
|
+
}
|
|
38
|
+
|
|
21
39
|
// For admin notices directly ">" at top of page above the Wizard header.
|
|
22
40
|
// PHP code should hide these notices, but just incase add this style.
|
|
23
41
|
> .notice {
|
|
@@ -29,8 +47,8 @@ body.newspack-wizard-page:not(.newspack-admin-header) {
|
|
|
29
47
|
padding-bottom: 202px;
|
|
30
48
|
}
|
|
31
49
|
|
|
32
|
-
@media screen and ( min-width:
|
|
33
|
-
padding-bottom:
|
|
50
|
+
@media screen and ( min-width: 1054px ) {
|
|
51
|
+
padding-bottom: 136px;
|
|
34
52
|
}
|
|
35
53
|
}
|
|
36
54
|
}
|
|
@@ -134,7 +152,7 @@ svg {
|
|
|
134
152
|
0 96px 0 0 wp-colors.$gray-700;
|
|
135
153
|
height: 24px;
|
|
136
154
|
margin: 68px auto 0;
|
|
137
|
-
max-width:
|
|
155
|
+
max-width: 1006px;
|
|
138
156
|
width: calc(100% - ( 32px * 2 ));
|
|
139
157
|
|
|
140
158
|
@media screen and ( min-width: 744px ) {
|
|
@@ -250,7 +268,7 @@ svg {
|
|
|
250
268
|
0 96px 0 0 wp-colors.$gray-700;
|
|
251
269
|
height: 24px;
|
|
252
270
|
margin: 0 auto;
|
|
253
|
-
max-width:
|
|
271
|
+
max-width: 1006px;
|
|
254
272
|
width: 100%;
|
|
255
273
|
|
|
256
274
|
@media screen and ( min-width: 744px ) {
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
--wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
|
|
14
14
|
--wp-admin-theme-color-darker-20: #{colors.$primary-800};
|
|
15
15
|
--wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
|
|
16
|
+
--wp-admin-theme-color-lighter-10: #{colors.$primary-000};
|
|
17
|
+
--wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
|
|
16
18
|
|
|
17
19
|
color: wp-colors.$gray-900;
|
|
18
20
|
|
|
@@ -44,12 +46,39 @@
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
&__header {
|
|
49
|
+
align-items: center;
|
|
47
50
|
background: white;
|
|
51
|
+
border-bottom: 1px solid wp-colors.$gray-300;
|
|
52
|
+
display: flex;
|
|
53
|
+
.newspack-wizard__fixed-header & {
|
|
54
|
+
position: sticky;
|
|
55
|
+
top: 0;
|
|
56
|
+
width: 100%;
|
|
57
|
+
z-index: 1000;
|
|
58
|
+
.admin-bar & {
|
|
59
|
+
@media only screen and ( min-width: 601px ) {
|
|
60
|
+
top: 46px;
|
|
61
|
+
}
|
|
62
|
+
@media only screen and ( min-width: 782px ) {
|
|
63
|
+
top: 32px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
&__inner {
|
|
68
|
+
flex: 1;
|
|
69
|
+
}
|
|
70
|
+
&__actions {
|
|
71
|
+
align-items: center;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex: 1 1 auto;
|
|
74
|
+
gap: 8px;
|
|
75
|
+
justify-content: flex-end;
|
|
76
|
+
padding: 0 24px 0 0;
|
|
77
|
+
}
|
|
48
78
|
}
|
|
49
79
|
|
|
50
80
|
&__title {
|
|
51
81
|
align-items: center;
|
|
52
|
-
border-bottom: 1px solid wp-colors.$gray-300;
|
|
53
82
|
display: flex;
|
|
54
83
|
|
|
55
84
|
h2 {
|
|
@@ -62,7 +91,7 @@
|
|
|
62
91
|
display: flex;
|
|
63
92
|
padding: 0 24px;
|
|
64
93
|
|
|
65
|
-
span {
|
|
94
|
+
> span {
|
|
66
95
|
color: wp-colors.$gray-700;
|
|
67
96
|
display: none;
|
|
68
97
|
margin-left: 8px;
|
|
@@ -119,14 +148,14 @@
|
|
|
119
148
|
}
|
|
120
149
|
}
|
|
121
150
|
|
|
151
|
+
&__section-header {
|
|
152
|
+
margin-bottom: 32px;
|
|
153
|
+
}
|
|
154
|
+
|
|
122
155
|
&__content {
|
|
123
156
|
margin: 0 auto;
|
|
124
|
-
max-width:
|
|
125
|
-
padding: 0
|
|
126
|
-
|
|
127
|
-
@media screen and ( min-width: 744px ) {
|
|
128
|
-
padding: 40px 84px;
|
|
129
|
-
}
|
|
157
|
+
max-width: calc(calc(var(--newspack-wizard-section-space) * 2) + var(--newspack-wizard-section-width));
|
|
158
|
+
padding: calc(var(--newspack-wizard-section-space) * 2) var(--newspack-wizard-section-space) 0;
|
|
130
159
|
|
|
131
160
|
// Typography
|
|
132
161
|
|
|
@@ -141,11 +170,11 @@
|
|
|
141
170
|
|
|
142
171
|
// Thematic Break
|
|
143
172
|
|
|
144
|
-
hr {
|
|
173
|
+
hr:not(.newspack-divider) {
|
|
145
174
|
background: wp-colors.$gray-300;
|
|
146
175
|
border: 0;
|
|
147
176
|
height: 1px;
|
|
148
|
-
margin:
|
|
177
|
+
margin: 32px 0;
|
|
149
178
|
|
|
150
179
|
@media screen and ( min-width: 744px ) {
|
|
151
180
|
margin: 64px 0;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snackbar.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies.
|
|
7
|
+
*/
|
|
8
|
+
import { Snackbar as BaseComponent } from '@wordpress/components';
|
|
9
|
+
import { useDispatch } from '@wordpress/data';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies.
|
|
13
|
+
*/
|
|
14
|
+
import { WIZARD_STORE_NAMESPACE } from '../store';
|
|
15
|
+
import './style.scss';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* External dependencies.
|
|
19
|
+
*/
|
|
20
|
+
import classnames from 'classnames';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* WizardSnackbar component.
|
|
24
|
+
*
|
|
25
|
+
* @param {Object} props - The component props.
|
|
26
|
+
* @param {Object[]} props.actions - The actions to display in the snackbar.
|
|
27
|
+
* @param {JSX.Element} props.children - The component children.
|
|
28
|
+
* @param {Object} props.props - The component props. See: https://wordpress.github.io/gutenberg/?path=/docs/components-snackbar--docs
|
|
29
|
+
* @param {string} props.position - The snackbar position.
|
|
30
|
+
* @param {string} props.type - The snackbar type: 'info', 'success', 'warning', or 'error'.
|
|
31
|
+
* @return {JSX.Element} The component.
|
|
32
|
+
*/
|
|
33
|
+
const WizardSnackbar = ( { children, position = 'bottom-left', type = 'info', actions = [], ...props } ) => {
|
|
34
|
+
const className = classnames(
|
|
35
|
+
'newspack-wizard__snackbar',
|
|
36
|
+
props.className,
|
|
37
|
+
`newspack-wizard__snackbar--${ position }`,
|
|
38
|
+
`newspack-wizard__snackbar--${ type }`
|
|
39
|
+
);
|
|
40
|
+
const { removeNotice, resetNotices } = useDispatch( WIZARD_STORE_NAMESPACE );
|
|
41
|
+
const onRemove = () => {
|
|
42
|
+
if ( props.onRemove ) {
|
|
43
|
+
props.onRemove();
|
|
44
|
+
}
|
|
45
|
+
if ( props.id ) {
|
|
46
|
+
removeNotice( props.id );
|
|
47
|
+
} else {
|
|
48
|
+
resetNotices();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return (
|
|
52
|
+
<BaseComponent className={ className } { ...props } onRemove={ onRemove } actions={ actions }>
|
|
53
|
+
{ children }
|
|
54
|
+
</BaseComponent>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default WizardSnackbar;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.newspack-wizard {
|
|
2
|
+
&__snackbar {
|
|
3
|
+
border-bottom: 2px solid transparent;
|
|
4
|
+
bottom: 16px;
|
|
5
|
+
left: 16px;
|
|
6
|
+
max-width: calc(100vw - 32px);
|
|
7
|
+
position: fixed;
|
|
8
|
+
z-index: 99999;
|
|
9
|
+
&--success {
|
|
10
|
+
border-color: var(--newspack-ui-color-success-60);
|
|
11
|
+
}
|
|
12
|
+
&--error {
|
|
13
|
+
border-color: var(--newspack-ui-color-error-60);
|
|
14
|
+
}
|
|
15
|
+
&--warning {
|
|
16
|
+
border-color: var(--newspack-ui-color-warning-40);
|
|
17
|
+
}
|
|
18
|
+
@media screen and ( min-width: 783px ) {
|
|
19
|
+
left: calc(36px + 16px); /* 36px for admin menu bar */
|
|
20
|
+
}
|
|
21
|
+
@media screen and ( min-width: 960px ) {
|
|
22
|
+
left: calc(160px + 16px); /* 160px for admin menu bar */
|
|
23
|
+
}
|
|
24
|
+
&.newspack-wizard__snackbar--bottom-right,
|
|
25
|
+
&.newspack-wizard__snackbar--top-right {
|
|
26
|
+
left: auto;
|
|
27
|
+
right: calc(16px);
|
|
28
|
+
}
|
|
29
|
+
&.newspack-wizard__snackbar--top-left,
|
|
30
|
+
&.newspack-wizard__snackbar--top-right {
|
|
31
|
+
bottom: auto;
|
|
32
|
+
top: calc(16px + 46px); /* 46px for admin bar */
|
|
33
|
+
@media screen and ( min-width: 783px ) {
|
|
34
|
+
top: calc(16px + 32px); /* 32px for admin bar */
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
a,
|
|
38
|
+
.components-button.is-link {
|
|
39
|
+
color: var(--newspack-ui-color-neutral-0);
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
margin-left: 16px;
|
|
42
|
+
&:hover,
|
|
43
|
+
&:focus {
|
|
44
|
+
color: var(--newspack-ui-color-neutral-10);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|