Skip to content

Commit 67d3423

Browse files
committed
refactor styles for clean separation and css variables
1 parent e1ea074 commit 67d3423

File tree

3 files changed

+35
-49
lines changed

3 files changed

+35
-49
lines changed

packages/dialtone-css/lib/build/less/components/banner.less

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
--banner-line-height: var(--dt-font-line-height-200);
1919
--banner-dialog-padding-y: var(--dt-spacing-100);
2020
--banner-dialog-padding-x: var(--dt-spacing-200);
21+
--notice-icon-gap: var(--dt-spacing-100);
22+
--notice-actions-align: inherit;
2123

2224
position: fixed;
2325
inset-block-start: 0;
@@ -26,7 +28,7 @@
2628
max-inline-size: 100%;
2729
padding: 0;
2830
line-height: var(--banner-line-height);
29-
border-block-end: 1px solid var(--banner-color-border);
31+
border-block-end: var(--dt-size-border-100) solid var(--banner-color-border);
3032
border-radius: 0;
3133
box-shadow: none;
3234

@@ -50,27 +52,18 @@
5052
// $ CONTENT CONTAINER
5153
// ----------------------------------------------------------------------------
5254
.d-banner__dialog {
55+
--notice-icon-block-offset: var(--dt-spacing-0);
56+
--notice-content-direction: row;
57+
--notice-content-gap: var(--dt-spacing-75);
58+
--notice-content-align: baseline;
59+
5360
position: relative;
5461
display: flex;
5562
align-items: center;
5663
inline-size: 100%;
5764
min-block-size: calc(var(--dt-layout-75) + var(--dt-spacing-25));
5865
margin: 0 auto;
5966
padding: var(--banner-dialog-padding-y) var(--banner-dialog-padding-x);
60-
61-
.d-notice__icon {
62-
margin-block-start: var(--dt-spacing-0);
63-
}
64-
65-
.d-notice__content {
66-
flex-direction: row;
67-
gap: var(--dt-spacing-75);
68-
align-items: baseline;
69-
}
70-
71-
.d-notice__message {
72-
font: var(--dt-text-body-sm);
73-
}
7467
}
7568

7669
// ============================================================================

packages/dialtone-css/lib/build/less/components/notice.less

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@
2525
--notice-border-radius: var(--dt-size-radius-400);
2626
--notice-box-shadow: 0 0 0 var(--dt-size-border-100) var(--notice-color-shadow) inset;
2727

28-
// Base Styles
28+
// Shared Styles
2929
// ------------------------------------------------------------------------
30-
display: flex;
31-
align-items: start;
3230
box-sizing: border-box;
3331
inline-size: 100%;
3432
max-inline-size: var(--dt-layout-1000);
@@ -41,6 +39,11 @@
4139
box-shadow: var(--notice-box-shadow);
4240
}
4341

42+
.d-notice {
43+
display: flex;
44+
align-items: start;
45+
}
46+
4447
// ============================================================================
4548
// $ NOTICE AREAS
4649
// ============================================================================
@@ -49,9 +52,10 @@
4952
.d-notice__content {
5053
display: flex;
5154
flex: 1 auto;
52-
flex-direction: column;
55+
flex-direction: var(--notice-content-direction, column);
5356
margin-inline-end: var(--dt-spacing-200);
54-
gap: var(--dt-spacing-100);
57+
gap: var(--notice-content-gap, var(--dt-spacing-100));
58+
align-items: var(--notice-content-align, normal);
5559
align-self: center;
5660
}
5761

@@ -62,10 +66,10 @@
6266
flex: 0 auto;
6367
gap: var(--dt-spacing-100);
6468
align-items: center;
65-
align-self: start;
69+
align-self: var(--notice-actions-align, start);
6670

67-
.d-banner & {
68-
align-self: inherit;
71+
:where(button:first-child) {
72+
margin-inline-start: var(--notice-actions-button-offset, 0);
6973
}
7074

7175
.d-btn {
@@ -79,16 +83,12 @@
7983
display: flex;
8084
flex: 0 auto;
8185
color: var(--notice-color-icon);
82-
margin-inline-end: var(--dt-spacing-150);
83-
margin-block-start: var(--dt-spacing-25);
86+
margin-inline-end: var(--notice-icon-gap, var(--dt-spacing-150));
87+
margin-block-start: var(--notice-icon-block-offset, var(--dt-spacing-25));
8488

8589
&--has-title {
8690
margin-block-start: var(--dt-spacing-0);
8791
}
88-
89-
.d-banner & {
90-
margin-inline-end: var(--dt-spacing-100);
91-
}
9292
}
9393

9494
// ============================================================================
@@ -185,16 +185,14 @@
185185

186186
// $$ TRUNCATE TEXT
187187
// ----------------------------------------------------------------------------
188-
.d-notice.d-notice--truncate {
189-
.d-notice__content {
190-
overflow: hidden;
191-
192-
.d-notice__title,
193-
.d-notice__message {
194-
overflow: hidden;
195-
white-space: nowrap;
196-
text-overflow: ellipsis;
197-
}
198-
}
188+
.d-notice--truncate :where(.d-notice__content) {
189+
overflow: hidden;
190+
}
191+
192+
.d-notice--truncate :where(.d-notice__title),
193+
.d-notice--truncate :where(.d-notice__message) {
194+
overflow: hidden;
195+
white-space: nowrap;
196+
text-overflow: ellipsis;
199197
}
200198
}

packages/dialtone-css/lib/build/less/components/toast.less

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,11 @@
5858
// $ CONTENT CONTAINER
5959
// ----------------------------------------------------------------------------
6060
.d-toast__dialog {
61+
--notice-actions-button-offset: var(--dt-spacing-400);
62+
6163
position: relative;
6264
display: flex;
6365
align-items: start;
64-
65-
.d-notice__actions :where(button:first-child) {
66-
margin-inline-start: var(--dt-spacing-400); // 32
67-
}
6866
}
6967

7068
// ============================================================================
@@ -206,14 +204,11 @@
206204
}
207205

208206
.d-toast-alternate__dialog {
207+
--notice-actions-button-offset: var(--dt-spacing-400);
208+
209209
position: relative;
210210
align-items: center;
211211
inline-size: var(--dt-layout-100-percent);
212-
213-
214-
.d-notice__actions :where(button:first-child) {
215-
margin-inline-start: var(--dt-spacing-400); // 32
216-
}
217212
}
218213

219214
.d-toast-alternate__header {

0 commit comments

Comments
 (0)