Skip to content

Commit

Permalink
feat(snackbar): compensate bottom margin (#6659)
Browse files Browse the repository at this point in the history
  • Loading branch information
akcent1132 authored Mar 19, 2024
1 parent 1985d66 commit a3b96b2
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 20 deletions.
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.

0 comments on commit a3b96b2

Please sign in to comment.