diff --git a/core/src/components/segment-content/segment-content.scss b/core/src/components/segment-content/segment-content.scss index 9dd510b5d9..cec9a0b031 100644 --- a/core/src/components/segment-content/segment-content.scss +++ b/core/src/components/segment-content/segment-content.scss @@ -2,6 +2,8 @@ :host { scroll-snap-align: center; + flex-shrink: 0; + width: 100%; } diff --git a/core/src/components/segment-view/segment-view.tsx b/core/src/components/segment-view/segment-view.tsx index b61c07bdba..96389d8b2d 100644 --- a/core/src/components/segment-view/segment-view.tsx +++ b/core/src/components/segment-view/segment-view.tsx @@ -50,9 +50,9 @@ export class SegmentView implements ComponentInterface { this.el.scrollTo({ top: 0, left: index * sectionWidth, - behavior: 'smooth' + behavior: 'smooth', }); - } + }; private getSegmentButtons(): HTMLIonSegmentButtonElement[] | [] { const { segmentEl } = this; diff --git a/core/src/components/segment/segment.tsx b/core/src/components/segment/segment.tsx index fa6e426f53..08ded86aa3 100644 --- a/core/src/components/segment/segment.tsx +++ b/core/src/components/segment/segment.tsx @@ -83,8 +83,8 @@ export class Segment implements ComponentInterface { protected valueChanged(value: SegmentValue | undefined, oldValue?: SegmentValue | undefined) { if (oldValue !== undefined && value !== undefined) { const buttons = this.getButtons(); - const previous = buttons.find(button => button.value === oldValue); - const current = buttons.find(button => button.value === value); + const previous = buttons.find((button) => button.value === oldValue); + const current = buttons.find((button) => button.value === value); if (previous && current) { this.checkButton(previous, current); diff --git a/core/src/components/segment/test/content-component/index.html b/core/src/components/segment/test/content-component/index.html index 4c1d08bb2f..51ea3c0139 100644 --- a/core/src/components/segment/test/content-component/index.html +++ b/core/src/components/segment/test/content-component/index.html @@ -1,83 +1,83 @@ + + + Segment - Content Component + + + + + + + - - - Segment - Content Component - - - - - - - - - - - - - Segment - Content Component - - - - - - Home - - - - Radio - - - - Library - - - - Search - - - - - - - - - - - Home card title - Home card content - - - - - - - Radio card title - Radio card content - - - - - - - Library card title - Library card content - - - - - - - Search card title - Search card content - - - - - - - + + + + + Segment - Content Component + + + + + + Home + + + + Radio + + + + Library + + + + Search + + + + + + + + + + Home card title + Home card content + + + + + + + Radio card title + Radio card content + + + + + + + Library card title + Library card content + + + + + + + Search card title + Search card content + + + + + + + diff --git a/core/src/components/segment/test/content/index.html b/core/src/components/segment/test/content/index.html index f035686d3e..952c50d507 100644 --- a/core/src/components/segment/test/content/index.html +++ b/core/src/components/segment/test/content/index.html @@ -1,133 +1,133 @@ + + + Segment - Content + + + + + + - - - Segment - Content - - - - - - + - - - - - - - Segment - Content - - - - - - Home - - - - Radio - - - - Library - - - - Search - - - - - - -
-
- - - Home card title - Home card content - - -
-
- - - Radio card title - Radio card content - - -
-
- - - Library card title - Library card content - - -
- -
-
-
- - - + /* Hide scrollbar in webkit */ + #segment-view::-webkit-scrollbar { + display: none; + } + + #segment-view .segment-content { + scroll-snap-align: center; + flex-shrink: 0; + width: 100%; + } + + + + + + + + Segment - Content + + + + + + Home + + + + Radio + + + + Library + + + + Search + + + + + + +
+
+ + + Home card title + Home card content + + +
+
+ + + Radio card title + Radio card content + + +
+
+ + + Library card title + Library card content + + +
+ +
+
+
+ + +