Skip to content

Commit 00a6b2d

Browse files
rugoncalvesbrandyscarneyIonitron
authored
feat(item): add styles for disabled state in ionic theme (#29583)
Issue number: internal --------- ## What is the new behavior? - Added scss for the disabled state of `ion-item` for the Ionic theme - Added disabled elements to test page ## Does this introduce a breaking change? - [ ] Yes - [x] No --------- Co-authored-by: Brandy Carney <[email protected]> Co-authored-by: ionitron <[email protected]> Co-authored-by: Brandy Carney <[email protected]>
1 parent 0807e6b commit 00a6b2d

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

core/src/components/item/item.ionic.scss

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,25 @@
9191
}
9292
}
9393

94-
// Item: Activated
94+
// Item: Disabled
9595
// --------------------------------------------------
96+
:host(.item-disabled) {
97+
cursor: default;
98+
pointer-events: none;
99+
100+
&::after {
101+
@include globals.position(0, 0, 0, 0);
102+
103+
position: absolute;
96104

105+
background: #{globals.$ionic-state-disabled};
106+
107+
content: "";
108+
}
109+
}
110+
111+
// Item: Activated
112+
// --------------------------------------------------
97113
:host(.ion-activated) .item-native {
98114
background: var(--background-activated);
99115
}

core/src/components/item/test/disabled/item.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { configs, test } from '@utils/test/playwright';
44
/**
55
* This behavior does not vary across directions
66
*/
7-
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
7+
configs({ modes: ['ionic-md', 'md', 'ios'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
88
test.describe(title('item: disabled state'), () => {
99
test('should not have visual regressions', async ({ page }) => {
1010
await page.goto(`/src/components/item/test/disabled`, config);

core/src/components/item/test/theme-ionic/index.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,28 +135,30 @@ <h1>Heading</h1>
135135
</ion-item>
136136

137137
<ion-item>
138+
<ion-label slot="start">Start</ion-label>
138139
<ion-label>
139140
<h1>Heading</h1>
140141
<p>Normal paragraph</p>
141142
</ion-label>
142-
<ion-button slot="end" fill="outline">Outline</ion-button>
143143
</ion-item>
144144

145-
<ion-item>
146-
<ion-label slot="start">Start</ion-label>
145+
<ion-text color="primary">
146+
<h2>Disabled Item</h2>
147+
</ion-text>
148+
149+
<ion-item disabled>
147150
<ion-label>
148151
<h1>Heading</h1>
149152
<p>Normal paragraph</p>
150153
</ion-label>
151154
</ion-item>
152155

153-
<ion-item>
156+
<ion-item disabled>
154157
<ion-label slot="start">Start</ion-label>
155158
<ion-label>
156159
<h1>Heading</h1>
157160
<p>Normal paragraph</p>
158161
</ion-label>
159-
<ion-button slot="end" fill="outline">Outline</ion-button>
160162
</ion-item>
161163
<ion-item-divider>
162164
<ion-label>Item activatable</ion-label>

0 commit comments

Comments
 (0)