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(Group): new token for border-radius on mobile + spacing 8px #6769

Merged
merged 5 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
29 changes: 21 additions & 8 deletions packages/vkui/src/components/Group/Group.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
}
}

/* ////////////////////////////////////////////////// */

.Group__separator--spacing,
.Group__separator--separator {
display: none;
Expand Down Expand Up @@ -69,6 +71,8 @@
}
}

/* ////////////////////////////////////////////////// */

.Group--mode-card.Group--padding-s {
padding: 4px;
}
Expand Down Expand Up @@ -107,6 +111,15 @@
position: relative;
}

.Group--sizeX-compact.Group--mode-card {
border-radius: var(--vkui--size_border_radius_promo--regular);
}

@media (--sizeX-compact) {
.Group--sizeX-none.Group--mode-card {
border-radius: var(--vkui--size_border_radius_promo--regular);
}
}
@media (--sizeX-regular) {
.Group--sizeX-none.Group--mode-none {
background: var(--vkui--color_background_content);
Expand All @@ -118,16 +131,16 @@
.Group--sizeX-compact.Group--mode-card:first-of-type {
border-start-start-radius: 0;
border-start-end-radius: 0;
border-end-end-radius: var(--vkui--size_border_radius_paper--regular);
border-end-start-radius: var(--vkui--size_border_radius_paper--regular);
border-end-end-radius: var(--vkui--size_border_radius_promo--regular);
border-end-start-radius: var(--vkui--size_border_radius_promo--regular);
}

@media (--sizeX-compact) {
.Group--sizeX-none.Group--mode-card:first-of-type {
border-start-start-radius: 0;
border-start-end-radius: 0;
border-end-end-radius: var(--vkui--size_border_radius_paper--regular);
border-end-start-radius: var(--vkui--size_border_radius_paper--regular);
border-end-end-radius: var(--vkui--size_border_radius_promo--regular);
border-end-start-radius: var(--vkui--size_border_radius_promo--regular);
}
}

Expand Down Expand Up @@ -174,14 +187,14 @@
}
}

.Group--mode-plain + .Group__separator,
.Group--mode-plain + .Group__separator + .Group__separator {
/* Это отступы когда layout=plain между группами и сепариком вннутри группы в группе ПЕРВОЕ ПРАВИЛО БЕСПОЛЕЗНО */
padding-block: 8px;
}

@media (--sizeX-compact) {
.Group--sizeX-none.Group--mode-none + .Group__separator,
.Group--sizeX-none.Group--mode-none + .Group__separator + .Group__separator {
/* Это отступы когда layout=undefined между группами и сепариком вннутри группы в группе ПЕРВОЕ ПРАВИЛО БЕСПОЛЗЕНО */
padding-block: 8px;
}
}
Expand All @@ -193,8 +206,8 @@
color: var(--vkui--color_text_secondary);
}

.Group .Group,
.Group .Group + .Group__separator {
.Group .Group {
/* первое правило бесполезно, потому что всегда применяется к спэйсу, у которого через style задается отступ */
padding-inline: 0;
}

Expand Down
14 changes: 11 additions & 3 deletions packages/vkui/src/components/Group/Group.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { classNames, hasReactNode } from '@vkontakte/vkjs';
import { useAdaptivity } from '../../hooks/useAdaptivity';
import { useAdaptivityConditionalRender } from '../../hooks/useAdaptivityConditionalRender';
import { SizeTypeValues } from '../../lib/adaptivity';
import { warnOnce } from '../../lib/warnOnce';
import { HTMLAttributesWithRootRef } from '../../types';
Expand Down Expand Up @@ -95,6 +96,7 @@ export const Group = ({
}: GroupProps) => {
const { isInsideModal } = React.useContext(ModalRootContext);
const { sizeX = 'none' } = useAdaptivity();
const { sizeX: adaptiveSizeX } = useAdaptivityConditionalRender();

const mode = useGroupMode(modeProps, sizeX, isInsideModal);

Expand Down Expand Up @@ -136,10 +138,16 @@ export const Group = ({

{separator !== 'hide' && (
<React.Fragment>
<Spacing
<div
className={classNames(styles['Group__separator'], styles['Group__separator--spacing'])}
size={16}
/>
>
{adaptiveSizeX.compact && (
<Spacing className={adaptiveSizeX.compact.className} size={8} />
BlackySoul marked this conversation as resolved.
Show resolved Hide resolved
)}
{adaptiveSizeX.regular && (
<Spacing className={adaptiveSizeX.regular.className} size={16} />
)}
</div>
<Separator
className={classNames(
styles['Group__separator'],
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