Skip to content

Commit

Permalink
fix(modal): header height & paddings (#676)
Browse files Browse the repository at this point in the history
* fix(modal): header height

* fix(modal): paddings
  • Loading branch information
reme3d2y committed Jun 4, 2021
1 parent 5f9077a commit d8945c6
Show file tree
Hide file tree
Showing 31 changed files with 117 additions and 43 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions packages/modal/src/component.screenshots.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,37 @@ describe('Modal | ModalDesktop', () => {
['default', 'click'].map(testCase);
});

describe('Modal | ModalDesktop sizes', () => {
const testCase = (theme: string) => {
return screenshotTesting({
cases: generateTestCases({
componentName: 'Modal',
subComponentName: 'ModalDesktop',
testStory: false,
knobs: {
open: true,
header: true,
size: ['s', 'm', 'l'],
},
}),
viewport: {
width: 960,
height: 700,
},
screenshotOpts: {
fullPage: true,
},
matchImageSnapshotOptions: {
customSnapshotIdentifier: (...args) =>
`${theme}-${customSnapshotIdentifier(...args)}`,
},
theme,
})();
};

['default', 'click'].map(testCase);
});

describe('Modal | Footer layout', () => {
const testCase = (theme: string) => {
return screenshotTesting({
Expand Down
18 changes: 16 additions & 2 deletions packages/modal/src/components/content/Component.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,22 @@ export type ContentDesktopProps = ContentProps & {
* Размер
*/
size?: 's' | 'm' | 'l';

/**
* Флаг, что модальное окно открыто на весь экран
*/
fullscreen?: boolean;
};

export const ContentDesktop: FC<ContentDesktopProps> = ({ size, className, ...restProps }) => (
<Content className={cn(className, size && styles[size])} styles={styles} {...restProps} />
export const ContentDesktop: FC<ContentDesktopProps> = ({
size,
className,
fullscreen,
...restProps
}) => (
<Content
className={cn(className, size && styles[size], fullscreen && styles.fullscreen)}
styles={styles}
{...restProps}
/>
);
7 changes: 6 additions & 1 deletion packages/modal/src/components/content/desktop.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
padding: var(--modal-m-content-paddings);
}

.l {
.l,
.fullscreen {
padding: var(--modal-l-content-paddings);

&:last-child {
padding-bottom: var(--modal-l-content-no-footer-bottom-padding);
}
}
3 changes: 2 additions & 1 deletion packages/modal/src/components/footer/desktop.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
padding: var(--modal-m-footer-paddings);
}

.l {
.l,
.fullscreen {
padding: var(--modal-l-footer-paddings);
}
4 changes: 3 additions & 1 deletion packages/modal/src/components/header/desktop.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
padding: var(--modal-m-header-paddings);
}

.l {
.l,
.fullscreen {
min-height: var(--modal-header-l-min-height);
padding: var(--modal-l-header-paddings);
}

Expand Down
6 changes: 4 additions & 2 deletions packages/modal/src/vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
--modal-s-width: 476px;
--modal-m-width: 600px;
--modal-l-width: 800px;
--modal-header-min-height: 72px;
--modal-header-min-height: 48px;
--modal-header-l-min-height: 72px;

/* paddings */
--modal-s-header-paddings: 0 0 0 var(--gap-4xl);
Expand All @@ -23,7 +24,8 @@
--modal-s-footer-paddings: var(--gap-xl) var(--gap-4xl) var(--gap-4xl);
--modal-m-footer-paddings: var(--gap-xl) var(--gap-4xl) var(--gap-4xl);
--modal-l-footer-paddings: var(--gap-xl) var(--gap-6xl) var(--gap-6xl);
--modal-content-no-footer-bottom-padding: var(--gap-3xl);
--modal-content-no-footer-bottom-padding: var(--gap-4xl);
--modal-l-content-no-footer-bottom-padding: var(--gap-6xl);
--modal-content-no-header-top-padding: var(--gap-2xl);

/* closer */
Expand Down
1 change: 1 addition & 0 deletions packages/themes/src/mixins/modal/click.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/* sizes */
--modal-s-width: 500px;
--modal-header-min-height: 84px;
--modal-header-l-min-height: 84px;
--modal-backdrop-visible-background: color-mod(var(--color-light-graphic-primary) alpha(50%));
--modal-vertical-padding: var(--gap-4xl);
--modal-footer-default-gap: var(--gap-xl);
Expand Down

0 comments on commit d8945c6

Please sign in to comment.