Skip to content

Commit 69340bf

Browse files
fix(divider): remove safe areas from horizontal padding (#30311)
Issue number: internal --------- ## What is the current behavior? The horizontal padding of the divider component was being calculated taking into account safe areas. However, since this component can be placed inside other components that already take these areas into account, this is not necessary. ## What is the new behavior? - Removes the safe areas ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Confirmed with design: the new divider component’s main use case is to be used inside ion-content (or one of it’s children). As such, the responsibility of taking into account safe areas will fall on the developer (as it’s already stated in the [documentation](https://ionicframework.com/docs/api/content#safe-area-padding)). This means, the divider component itself will not account for the safe areas for its' specific padding. The default spacing also changed from `xxsmall` to `medium`
1 parent 8855618 commit 69340bf

22 files changed

+7
-17
lines changed

core/api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ ion-datetime-button,part,native
747747

748748
ion-divider,shadow
749749
ion-divider,prop,inset,boolean,false,false,false
750-
ion-divider,prop,spacing,"large" | "medium" | "small" | "xlarge" | "xsmall" | "xxlarge" | "xxsmall" | undefined,'xxsmall',false,true
750+
ion-divider,prop,spacing,"large" | "medium" | "small" | "xlarge" | "xsmall" | "xxlarge" | "xxsmall" | undefined,'medium',false,true
751751
ion-divider,css-prop,--margin-bottom,ionic
752752
ion-divider,css-prop,--margin-bottom,ios
753753
ion-divider,css-prop,--margin-bottom,md

core/src/components.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ export namespace Components {
11701170
*/
11711171
"inset": boolean;
11721172
/**
1173-
* Set to `"xxsmall"` for the smallest spacing. Set to "xsmall" for very small spacing. Set to `"small"` for small spacing. Set to "medium" for medium spacing. Set to "large" for large spacing. Set to `"xlarge"` for the largest spacing. Defaults to `"xxsmall"`.
1173+
* Set to `"xxsmall"` for the smallest spacing. Set to "xsmall" for very small spacing. Set to `"small"` for small spacing. Set to "medium" for medium spacing. Set to "large" for large spacing. Set to `"xlarge"` for the largest spacing. Defaults to `"medium"`.
11741174
*/
11751175
"spacing"?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge';
11761176
}
@@ -6642,7 +6642,7 @@ declare namespace LocalJSX {
66426642
*/
66436643
"inset"?: boolean;
66446644
/**
6645-
* Set to `"xxsmall"` for the smallest spacing. Set to "xsmall" for very small spacing. Set to `"small"` for small spacing. Set to "medium" for medium spacing. Set to "large" for large spacing. Set to `"xlarge"` for the largest spacing. Defaults to `"xxsmall"`.
6645+
* Set to `"xxsmall"` for the smallest spacing. Set to "xsmall" for very small spacing. Set to `"small"` for small spacing. Set to "medium" for medium spacing. Set to "large" for large spacing. Set to `"xlarge"` for the largest spacing. Defaults to `"medium"`.
66466646
*/
66476647
"spacing"?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge';
66486648
}

core/src/components/divider/divider.common.scss

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,11 @@
1212
--padding-start: 0px;
1313
--padding-end: 0px;
1414

15+
@include padding-horizontal(var(--padding-start), var(--padding-end));
16+
1517
display: block;
1618

1719
width: 100%;
18-
19-
/* stylelint-disable */
20-
@include ltr() {
21-
padding-right: calc(var(--padding-end) + var(--ion-safe-area-right, 0px));
22-
padding-left: calc(var(--padding-start) + var(--ion-safe-area-left, 0px));
23-
}
24-
25-
@include rtl() {
26-
padding-right: calc(var(--padding-start) + var(--ion-safe-area-right, 0px));
27-
padding-left: calc(var(--padding-end) + var(--ion-safe-area-left, 0px));
28-
}
29-
/* stylelint-enable */
3020
}
3121

3222
:host hr {

core/src/components/divider/divider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ export class Divider implements ComponentInterface {
2020
* Set to "large" for large spacing.
2121
* Set to `"xlarge"` for the largest spacing.
2222
*
23-
* Defaults to `"xxsmall"`.
23+
* Defaults to `"medium"`.
2424
*/
2525
@Prop({ reflect: true }) spacing?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' =
26-
'xxsmall';
26+
'medium';
2727

2828
/**
2929
* If `true`, the divider will have horizontal margins
341 Bytes
Loading
390 Bytes
Loading
152 Bytes
Loading
428 Bytes
Loading
626 Bytes
Loading
387 Bytes
Loading

0 commit comments

Comments
 (0)