Skip to content

Commit 45df145

Browse files
committed
fix(Dialog): set correct minimum dialog size
1 parent 728f3d9 commit 45df145

File tree

7 files changed

+12
-6
lines changed

7 files changed

+12
-6
lines changed

.changeset/silver-dots-sleep.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fix minimum dialog size.

src/components/GlobalStyles.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const GlobalStylesElement = createGlobalStyle<GlobalStylesElementProps>`
166166
}
167167
168168
.cube-notification-container {
169-
min-width: 288px;
169+
min-width: var(--min-dialog-size);
170170
max-width: 340px;
171171
width: calc(100vw - 32px);
172172
position: fixed;

src/components/organisms/Modal/Modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export function Modal(allProps: CubeModalProps) {
209209
shadow={true}
210210
border={false}
211211
radius="1x"
212-
width={`288px (100% - 32px) ${
212+
width={`@min-dialog-size (100% - 32px) ${
213213
typeof width === 'number' ? `${width}px` : width || '360px'
214214
}`}
215215
style={{ textAlign: 'left' }}

src/components/overlays/Dialog/Dialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const DialogElement = tasty({
4242
placeItems: 'stretch',
4343
placeContent: 'stretch',
4444
width: {
45-
'': '288px @dialog-size 90vw',
45+
'': '@min-dialog-size @dialog-size 90vw',
4646
'[data-type="fullscreen"]': '90vw 90vw',
4747
'[data-type="fullscreenTakeover"]': '100vw 100vw',
4848
'[data-type="panel"]': 'auto',
@@ -287,7 +287,7 @@ const DialogContent = forwardRef(function DialogContent(
287287
{...dialogProps}
288288
tabIndex={undefined}
289289
mods={{ dismissable: isDismissable }}
290-
style={{ '--dialog-size': `${sizePxMap[size] || 288}px` }}
290+
style={{ '--dialog-size': `${sizePxMap[size] || sizePxMap.small}px` }}
291291
data-type={type}
292292
data-size={size}
293293
>

src/components/overlays/Modal/Modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const ModalElement = tasty({
5252
'[data-type="panel"]': 'auto',
5353
},
5454
width: {
55-
'': '288px 90vw',
55+
'': '@min-dialog-size 90vw',
5656
'[data-type="panel"]': 'auto',
5757
},
5858
pointerEvents: 'none',

src/components/overlays/Modal/Tray.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const TrayElement = tasty({
3434
},
3535
zIndex: 10,
3636
height: 'max 90dvh',
37-
width: '288px 90vw',
37+
width: '@min-dialog-size 90vw',
3838
pointerEvents: 'auto',
3939
transition:
4040
'transform .25s ease-in-out, opacity .25s linear, visibility 0ms linear',

src/tokens.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const TOKENS = {
4848
'leaf-sharp-radius': '0px',
4949
'fade-width': '32px',
5050
transition: '80ms',
51+
'min-dialog-size': 'min(288px, calc(100vw - (2 * var(--gap))))',
5152
'clear-color': 'transparent',
5253
'border-color': color('dark', 0.1),
5354
'border-opaque-color': 'rgb(227 227 233)',

0 commit comments

Comments
 (0)