Skip to content

Commit

Permalink
feat(snackbar): actionless adaptive solution
Browse files Browse the repository at this point in the history
  • Loading branch information
akcent1132 committed Mar 12, 2024
1 parent bcbe7b6 commit 507809a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions packages/vkui/src/components/Snackbar/Snackbar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@
padding-block-end: var(--vkui_internal--safe_area_inset_bottom);
}

.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__action {
margin-block-end: calc(
-1 * (
var(--vkui--size_button_small_height--regular) -
var(--vkui--font_subhead--line_height--regular)
) / 2
);
}

/* iOS */
.Snackbar--ios .Snackbar__in,
.Snackbar--ios .Snackbar__snackbar {
Expand Down
3 changes: 2 additions & 1 deletion packages/vkui/src/components/Snackbar/Snackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const Snackbar = ({
...restProps
}: SnackbarProps) => {
const platform = usePlatform();
const { viewWidth } = useAdaptivityWithJSMediaQueries();
const { sizeY, viewWidth } = useAdaptivityWithJSMediaQueries();
const isDesktop = viewWidth >= ViewWidth.SMALL_TABLET;
const { waitTransitionFinish } = useWaitTransitionFinish();

Expand Down Expand Up @@ -180,6 +180,7 @@ export const Snackbar = ({
closing && styles['Snackbar--closing'],
touched && styles['Snackbar--touched'],
isDesktop && styles['Snackbar--desktop'],
sizeY === 'regular' && styles['Snackbar--sizeY-regular'],
)}
style={offsetY ? { ...style, bottom: offsetY } : style}
>
Expand Down

0 comments on commit 507809a

Please sign in to comment.