Skip to content

Commit

Permalink
fix(plugin-basic-ui): add maxWidth option in <Modal /> (daangn#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyfromundefined authored Nov 19, 2024
1 parent eb9ed7c commit eb4578f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-dingos-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stackflow/plugin-basic-ui": patch
---

fix(plugin-basic-ui): add `maxWidth` option in <Modal />
4 changes: 3 additions & 1 deletion extensions/plugin-basic-ui/src/basicUIPlugin.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const GLOBAL_VARS = {
borderRadius: "bottom-sheet-border-radius",
},
modal: {
borderRadius: "bottom-sheet-border-radius",
borderRadius: "modal-border-radius",
maxWidth: "modal-max-width",
},
};

Expand Down Expand Up @@ -68,6 +69,7 @@ const androidValues: GlobalVars = {
},
modal: {
borderRadius: "1rem",
maxWidth: "100%",
},
};

Expand Down
1 change: 1 addition & 0 deletions extensions/plugin-basic-ui/src/components/Modal.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const paper = style([
{
backgroundColor: globalVars.backgroundColor,
width: "100%",
maxWidth: globalVars.modal.maxWidth,
margin: "0 2.5rem",
boxShadow:
"0px 0.625rem 2.375rem rgba(0, 0, 0, 0.15), 0px .5625rem 2.875rem rgba(0, 0, 0, 0.12), 0px .3125rem .9375rem rgba(0, 0, 0, 0.1)",
Expand Down
4 changes: 3 additions & 1 deletion extensions/plugin-basic-ui/src/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const Modal: React.FC<ModalProps> = ({
backgroundColor,
dimBackgroundColor,
borderRadius = "1rem",
maxWidth,
onOutsideClick,
children,
}) => {
Expand Down Expand Up @@ -78,9 +79,10 @@ const Modal: React.FC<ModalProps> = ({
ref={containerRef}
style={assignInlineVars(
compactMap({
[globalVars.bottomSheet.borderRadius]: borderRadius,
[globalVars.backgroundColor]: backgroundColor,
[globalVars.dimBackgroundColor]: dimBackgroundColor,
[globalVars.modal.borderRadius]: borderRadius,
[globalVars.modal.maxWidth]: maxWidth,
[css.vars.zIndexes.dim]: `${zIndexBase}`,
[css.vars.zIndexes.paper]: `${zIndexPaper}`,
[css.vars.transitionDuration]:
Expand Down

0 comments on commit eb4578f

Please sign in to comment.