From 44298a2548767b5e217c25582236cf455a36bf1a Mon Sep 17 00:00:00 2001 From: adarleyjrr <50996706+adarleyjrr@users.noreply.github.com> Date: Mon, 13 Mar 2023 11:35:43 -0400 Subject: [PATCH 1/2] feat: added option to center modal container --- CHANGELOG.md | 2 ++ src/components/Modal/Modal.stories.tsx | 7 +++++++ src/components/Modal/index.css | 4 ++++ src/components/Modal/index.tsx | 10 +++++++++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4660ebb..9da0dfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added option to center modal container + ### Fixed ## [9.2.5] 2023-01-18 diff --git a/src/components/Modal/Modal.stories.tsx b/src/components/Modal/Modal.stories.tsx index 6055c45..761190a 100644 --- a/src/components/Modal/Modal.stories.tsx +++ b/src/components/Modal/Modal.stories.tsx @@ -25,6 +25,13 @@ export default { options: minWidthOptions } }, + position: { + defaultValue: 'default', + control: { + type: 'select', + options: ['default', 'center'] + } + }, isClosable: { defaultValue: true, control: { diff --git a/src/components/Modal/index.css b/src/components/Modal/index.css index 4de0577..8c67a56 100644 --- a/src/components/Modal/index.css +++ b/src/components/Modal/index.css @@ -47,6 +47,10 @@ &.new { border-radius: 20px 45px 20px 20px; } + /* Centers modal container */ + &.center { + @apply my-auto + } } .pui-modal-header { diff --git a/src/components/Modal/index.tsx b/src/components/Modal/index.tsx index dbd2c9c..31b1107 100644 --- a/src/components/Modal/index.tsx +++ b/src/components/Modal/index.tsx @@ -31,6 +31,10 @@ export type ModalProps = { * What style of the component should be used */ variant?: 'default' | 'new'; + /** + * Define how modal should position itself + */ + position?: 'default' | 'center'; /** * Whether the padding of content container should be removed or not */ @@ -51,6 +55,7 @@ export type ModalProps = { * @param props.title A title string * @param props.isClosable If true close button won't be displayed and the user won't be able to close modal by any means * @param props.variant What style of the component should be used + * @param props.position Define how modal should position itself * @param props.removePadding Whether the padding of content container should be removed or not * @param props.actions A component that if provided will add a "actions" footer * @param props.children The provided children content @@ -63,6 +68,7 @@ export const Modal: React.FC> = ({ actions, removePadding, variant = 'default', + position = 'default', isClosable = true, children }) => { @@ -105,7 +111,9 @@ export const Modal: React.FC> = ({ return (
-
+

{title}

{/* Adds a close icon */} From 6cdd73f2f773508c184b15a7f0ea52c860db1353 Mon Sep 17 00:00:00 2001 From: adarleyjrr <50996706+adarleyjrr@users.noreply.github.com> Date: Mon, 13 Mar 2023 11:38:55 -0400 Subject: [PATCH 2/2] build: bumping version: 9.3.0 --- CHANGELOG.md | 8 ++++++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9da0dfb..7c27811 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,10 +23,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Added option to center modal container - ### Fixed +## [9.3.0] 2023-03-13 + +### Added + +- Added option to center modal container + ## [9.2.5] 2023-01-18 ### Fixed diff --git a/package-lock.json b/package-lock.json index 8455e0c..496c3a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@perimetre/ui", - "version": "9.2.5", + "version": "9.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@perimetre/ui", - "version": "9.2.5", + "version": "9.3.0", "license": "MIT", "dependencies": { "@babel/core": "^7.12.13", diff --git a/package.json b/package.json index 87e9a1d..3a0c4d8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@perimetre/ui", "description": "A component library made by @perimetre", - "version": "9.2.5", + "version": "9.3.0", "repository": { "type": "git", "url": "git+https://github.com/perimetre/ui.git"