Skip to content

Commit

Permalink
refactor(modal): Minor modal style updates
Browse files Browse the repository at this point in the history
  • Loading branch information
diogomateus committed Aug 13, 2024
1 parent 829adca commit 3d5bdac
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/modal/genericModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const GenericModal = ({
styles.footer
)}
>
<div className="px24 py16">
<div className="p24 pt16">
{footer}
</div>
</div>
Expand Down
11 changes: 11 additions & 0 deletions src/lib/components/modal/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ const story = {
className: {
description: 'Any additional className',
},
size: {
description: 'The size of the modal, either large or default.',
control: 'radio',
options: {
default: 'default',
large: 'large',
}
},
children: {
description: 'The content that gets displayed on the modal',
type: 'text',
Expand All @@ -42,6 +50,7 @@ const story = {
dismissible: true,
className: '',
children: 'Modal content to be displayed',
size: 'default',
},
parameters: {
componentSubtitle: 'Bottom or Regular modal will automatically choose what’s best to display based on the users screen width.',
Expand All @@ -59,6 +68,7 @@ export const BottomOrRegularModalStory = ({
dismissible,
isOpen,
onClose,
size,
title,
}: Props) => {
const [display, setDisplay] = useState(isOpen);
Expand All @@ -81,6 +91,7 @@ export const BottomOrRegularModalStory = ({
className={className}
title={title}
isOpen={display}
size={size}
onClose={handleOnClose}
>
<div style={{ padding: '0 24px 24px 24px' }}>
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface Props {
onClose: () => void;
className?: string;
dismissible?: boolean;
size?: 'default' | 'large';
footer?: ReactNode;
}

Expand Down
7 changes: 4 additions & 3 deletions src/lib/components/modal/regularModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styles from './style.module.scss';
import classNames from 'classnames';
import { GenericModal } from '../genericModal';

const RegularModal = ({ className = '', ...rest }: Props) => (
const RegularModal = ({ className = '', size, ...rest }: Props) => (
<GenericModal
classNames={{
wrapper: ({ isClosing }) => classNames(
Expand All @@ -14,8 +14,9 @@ const RegularModal = ({ className = '', ...rest }: Props) => (
}
),
container: classNames(
'bg-white br8 d-flex ai-center fd-column mx-auto my0 wmx8',
styles.container
'bg-white br8 d-flex ai-center fd-column mx-auto my0',
styles.container,
size === 'large' ? 'wmx10' : 'wmx8'
)
}}
{...rest}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/modal/regularModal/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
}

.container {
max-height: 96vh;
max-height: 90vh;
overflow: hidden;
}

0 comments on commit 3d5bdac

Please sign in to comment.