Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(snackbar): compensate bottom margin #6659

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,35 @@
overflow: hidden;
}

.Snackbar--layout-vertical .Snackbar__action {
margin-block-end: calc(
-1 * (
var(--vkui--size_button_small_height--compact) -
var(--vkui--font_subhead--line_height--compact)
) / 2
);
}

.Snackbar--sizeY-regular.Snackbar--layout-vertical .Snackbar__action {
margin-block-end: calc(
-1 * (
var(--vkui--size_button_small_height--regular) -
var(--vkui--font_subhead--line_height--regular)
) / 2
);
}

@media (--sizeY-regular) {
.Snackbar--sizeY-none.Snackbar--layout-vertical .Snackbar__action {
margin-block-end: calc(
-1 * (
var(--vkui--size_button_small_height--regular) -
var(--vkui--font_subhead--line_height--regular)
) / 2
);
}
}

.Snackbar--layout-vertical .Snackbar__content {
flex-direction: column;
align-items: flex-start;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { classNames } from '@vkontakte/vkjs';
import { useAdaptivity } from '../../../../hooks/useAdaptivity';
import { HTMLAttributesWithRootRef } from '../../../../types';
import { RootComponent } from '../../../RootComponent/RootComponent';
import { Paragraph } from '../../../Typography/Paragraph/Paragraph';
Expand All @@ -11,6 +12,11 @@ const stylesLayout = {
horizontal: styles['Snackbar--layout-horizontal'],
};

const sizeYClassNames = {
none: styles['Snackbar--sizeY-none'],
regular: styles['Snackbar--sizeY-regular'],
};

export interface BasicProps {
/**
* Элемент действия.
Expand Down Expand Up @@ -61,13 +67,15 @@ export function Basic({
children,
...restProps
}: SnackbarBasicProps) {
const { sizeY = 'none' } = useAdaptivity();
const layout = after || subtitle ? 'vertical' : layoutProps;

return (
<RootComponent
baseClassName={classNames(
styles['Snackbar__body'],
stylesLayout[layout],
sizeY !== 'compact' && sizeYClassNames[sizeY],
mode === 'dark' && styles['Snackbar--mode-dark'],
)}
{...restProps}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.