Skip to content

Commit c1ec78b

Browse files
Apply suggestions from code review
Co-authored-by: Brandy Smith <[email protected]>
1 parent 53a9e78 commit c1ec78b

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

core/src/components/divider/divider.scss

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/**
66
* @prop --margin-top: Top margin of the divider
77
* @prop --margin-bottom: Bottom margin of the divider
8-
* @prop --padding-end: Right margin of the divider
9-
* @prop --padding-start: Left padding of the divider
8+
* @prop --padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the divider
9+
* @prop --padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the divider
1010
*/
1111
--margin-top: 0px;
1212
--margin-bottom: 0px;
@@ -18,8 +18,16 @@
1818
width: 100%;
1919

2020
/* stylelint-disable */
21-
padding-right: var(--padding-end);
22-
padding-left: calc(var(--padding-start) + var(--ion-safe-area-left, 0px));
21+
@include ltr() {
22+
padding-right: var(--padding-end);
23+
padding-left: calc(var(--padding-start) + var(--ion-safe-area-left, 0px));
24+
}
25+
26+
@include rtl() {
27+
padding-right: calc(var(--padding-start) + var(--ion-safe-area-right, 0px));
28+
padding-left: var(--padding-end);
29+
}
30+
/* stylelint-enable */
2331
}
2432

2533
:host hr {
@@ -31,7 +39,7 @@
3139
margin-bottom: var(--margin-bottom);
3240

3341
border: none;
34-
border-top: #{globals.$ion-border-size-025} solid #{globals.$ion-border-default};
42+
border-top: globals.$ion-border-size-025 globals.$ion-border-style-solid globals.$ion-border-default;
3543
}
3644

3745
// Divider Spacing

core/src/components/divider/divider.tsx

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,33 @@ import { Component, Prop, Host, h } from '@stencil/core';
1414
export class Divider implements ComponentInterface {
1515
/**
1616
* Set to `"xxsmall"` for the smallest spacing.
17-
* Set to "xsmall" for a very small spacing.
18-
* Set to `"small"` for a small spacing.
19-
* Set to "medium" for a medium spacing.
20-
* Set to "large" for a large spacing.
17+
* Set to "xsmall" for very small spacing.
18+
* Set to `"small"` for small spacing.
19+
* Set to "medium" for medium spacing.
20+
* Set to "large" for large spacing.
2121
* Set to `"xlarge"` for the largest spacing.
2222
*
23-
* Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
23+
* Defaults to `"xxsmall"`.
2424
*/
25-
@Prop({ reflect: true }) spacing?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge';
25+
@Prop({ reflect: true }) spacing?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' = 'xxsmall';
2626

2727
/**
2828
* If `true`, the divider will have horizontal margins
2929
* By default, it's `false`
3030
*/
3131
@Prop() inset?: boolean = false;
3232

33-
private getSpacing(): string | undefined {
34-
const { spacing } = this;
35-
36-
if (spacing === undefined) {
37-
return 'xxsmall';
38-
}
39-
40-
return spacing;
41-
}
4233

4334
render() {
35+
const { inset, spacing } = this;
4436
const theme = getIonTheme(this);
45-
const spacing = this.getSpacing();
37+
4638
return (
4739
<Host
4840
class={{
4941
[theme]: true,
50-
[`divider-space-${spacing}`]: spacing !== undefined,
51-
[`divider-inset`]: this.inset || false,
42+
[`divider-spacing-${spacing}`]: spacing !== undefined,
43+
[`divider-inset`]: inset,
5244
}}
5345
>
5446
<hr />

core/src/components/divider/test/basic/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<div>
2727
<h3>Default</h3>
2828
Top
29-
<ion-divider ion-divider></ion-divider>
29+
<ion-divider></ion-divider>
3030
Bottom
3131
</div>
3232
<div>

0 commit comments

Comments
 (0)