Skip to content

Commit c58758a

Browse files
committed
feat(separator): rename component
1 parent 98932a8 commit c58758a

File tree

14 files changed

+63
-63
lines changed

14 files changed

+63
-63
lines changed

packages/components/src/action-card/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@
488488
}
489489
}
490490

491-
hr:not(.newspack-separator) {
491+
hr:not(.newspack-divider) {
492492
background: wp-colors.$gray-100;
493493
margin: 0;
494494
}

packages/components/src/card/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133

134134
// Thematic Break
135135

136-
hr:not(.newspack-separator) {
136+
hr:not(.newspack-divider) {
137137
background: wp-colors.$gray-300;
138138
border: 0;
139139
height: 1px;

packages/components/src/separator/README.md renamed to packages/components/src/divider/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Separator
1+
# Divider
22

33
Horizontal rule component with alignment, variant, and margin options.
44

@@ -15,11 +15,11 @@ Horizontal rule component with alignment, variant, and margin options.
1515
## Usage
1616

1717
```jsx
18-
import { Separator } from '@newspack/components';
18+
import { Divider } from 'newspack-components';
1919

20-
<Separator />
20+
<Divider />
2121

22-
<Separator alignment="full-width" variant="primary" />
22+
<Divider alignment="full-width" variant="primary" />
2323

24-
<Separator marginBottom={ 48 } marginTop={ 32 } variant="secondary" />
24+
<Divider marginBottom={ 48 } marginTop={ 32 } variant="secondary" />
2525
```
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Divider
3+
*/
4+
5+
/**
6+
* Internal dependencies
7+
*/
8+
import './style.scss';
9+
10+
/**
11+
* External dependencies
12+
*/
13+
import classNames from 'classnames';
14+
15+
const Divider = ( { alignment = 'none', className = undefined, marginBottom = 64, marginTop = 64, variant = 'default', ...otherProps } ) => {
16+
const classes = classNames(
17+
'newspack-divider',
18+
className,
19+
alignment && `newspack-divider--alignment-${ alignment }`,
20+
variant && `newspack-divider--variant-${ variant }`
21+
);
22+
23+
const style = {
24+
'--divider-margin-bottom': typeof marginBottom === 'number' ? `${ marginBottom }px` : marginBottom,
25+
'--divider-margin-top': typeof marginTop === 'number' ? `${ marginTop }px` : marginTop,
26+
};
27+
28+
return <hr className={ classes } style={ style } { ...otherProps } />;
29+
};
30+
31+
export default Divider;

packages/components/src/separator/style.scss renamed to packages/components/src/divider/style.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/**
2-
* Separator
2+
* Divider
33
*/
44

55
@use "~@wordpress/base-styles/colors" as wp-colors;
66

7-
.newspack-separator {
7+
.newspack-divider {
88
background: transparent;
99
border: 0;
1010
display: block;
1111
height: 1px;
12-
margin-bottom: min(32px, var(--separator-margin-bottom, 64px));
12+
margin-bottom: min(32px, var(--divider-margin-bottom, 64px));
1313
margin-left: 0;
1414
margin-right: 0;
15-
margin-top: min(32px, var(--separator-margin-top, 64px));
15+
margin-top: min(32px, var(--divider-margin-top, 64px));
1616
padding: 0;
1717

1818
@media screen and (min-width: 783px) {
19-
margin-bottom: var(--separator-margin-bottom, 64px);
20-
margin-top: var(--separator-margin-top, 64px);
19+
margin-bottom: var(--divider-margin-bottom, 64px);
20+
margin-top: var(--divider-margin-top, 64px);
2121
}
2222

2323
// Alignment

packages/components/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export { default as Card } from './card';
1010
export { default as CategoryAutocomplete } from './category-autocomplete';
1111
export { default as ColorPicker } from './color-picker';
1212
export { default as CustomSelectControl } from './custom-select-control';
13+
export { default as Divider } from './divider';
1314
export { default as FormTokenField } from './form-token-field';
1415
export { default as Footer } from './footer';
1516
export { default as Handoff } from './handoff';
@@ -29,7 +30,6 @@ export { default as ProgressBar } from './progress-bar';
2930
export { default as RadioControl } from './radio-control';
3031
export { default as SectionHeader } from './section-header';
3132
export { default as SelectControl } from './select-control';
32-
export { default as Separator } from './separator';
3333
export { default as Settings } from './settings';
3434
export { default as StepsList } from './steps-list';
3535
export { default as StepsListItem } from './steps-list-item';

packages/components/src/separator/index.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

packages/components/src/with-wizard-screen/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141

142142
// Thematic Break
143143

144-
hr:not(.newspack-separator) {
144+
hr:not(.newspack-divider) {
145145
background: wp-colors.$gray-300;
146146
border: 0;
147147
height: 1px;

src/wizards/audience/components/nrh-settings/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useEffect, useState } from '@wordpress/element';
88
/**
99
* Internal dependencies
1010
*/
11-
import { AutocompleteWithSuggestions, Button, Grid, Separator, TextControl } from '../../../../../packages/components/src';
11+
import { AutocompleteWithSuggestions, Button, Divider, Grid, TextControl } from '../../../../../packages/components/src';
1212
import { useWizardData } from '../../../../../packages/components/src/wizard/store/utils';
1313
import { WIZARD_STORE_NAMESPACE } from '../../../../../packages/components/src/wizard/store';
1414
import WizardsSection from '../../../wizards-section';
@@ -100,7 +100,7 @@ const NRHSettings = () => {
100100
{ __( 'Save Settings' ) }
101101
</Button>
102102
</div>
103-
<Separator alignment="full-width" variant="tertiary" />
103+
<Divider alignment="full-width" variant="tertiary" />
104104
</WizardsSection>
105105
);
106106
};

src/wizards/audience/views/setup/setup.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
Card,
1717
Grid,
1818
Notice,
19-
Separator,
19+
Divider,
2020
PluginInstaller,
2121
SectionHeader,
2222
TextControl,
@@ -125,7 +125,7 @@ export default withWizardScreen(
125125
) ) }
126126
{ config.enabled && (
127127
<Card noBorder>
128-
<Separator alignment="full-width" variant="tertiary" />
128+
<Divider alignment="full-width" variant="tertiary" />
129129
<ActionCard
130130
title={ __( 'Present newsletter signup after checkout and registration', 'newspack-plugin' ) }
131131
description={ __(
@@ -171,7 +171,7 @@ export default withWizardScreen(
171171
toggleOnChange={ value => updateConfig( 'oauth_redirect_to_ras', value ) }
172172
/>
173173

174-
<Separator alignment="full-width" variant="tertiary" />
174+
<Divider alignment="full-width" variant="tertiary" />
175175

176176
<SectionHeader
177177
title={ __( 'Email Service Provider (ESP) Advanced Settings', 'newspack-plugin' ) }
@@ -314,7 +314,7 @@ export default withWizardScreen(
314314
) }
315315
{ newspackAudience.can_use_salesforce && (
316316
<Card noBorder>
317-
<Separator alignment="full-width" variant="tertiary" />
317+
<Divider alignment="full-width" variant="tertiary" />
318318
<Salesforce />
319319
</Card>
320320
) }

0 commit comments

Comments
 (0)