@cloud-ru/uikit-product-site-banner 0.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,96 @@
1
+ .content {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: var(--site-banner-main-gap);
5
+
6
+ padding: 32px;
7
+ }
8
+
9
+ .title,
10
+ .description {
11
+ word-break: break-word;
12
+ }
13
+
14
+ .text {
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: 12px;
18
+ }
19
+
20
+ .buttons {
21
+ display: flex;
22
+ margin-top: auto;
23
+ gap: 16px;
24
+ }
25
+
26
+ .img {
27
+ width: 100%;
28
+ max-width: var(--site-banner-image-max-width);
29
+ max-height: var(--site-banner-image-max-height);
30
+
31
+ flex-shrink: 0;
32
+
33
+ &Wrapper {
34
+ width: 100%;
35
+ display: flex;
36
+ justify-content: center;
37
+ align-items: center;
38
+ }
39
+ }
40
+
41
+ .erid {
42
+ position: absolute;
43
+ right: 2px;
44
+ top: 2px;
45
+ }
46
+
47
+ .root {
48
+ position: relative;
49
+
50
+ display: grid;
51
+
52
+ grid-template-columns: 1fr var(--site-banner-image-max-width);
53
+
54
+ &[data-layout-type='tablet'] {
55
+ display: flex;
56
+ flex-direction: column;
57
+
58
+ .content {
59
+ padding: 24px;
60
+ }
61
+
62
+ .text {
63
+ gap: 8px;
64
+ }
65
+
66
+ .buttons {
67
+ flex-direction: column;
68
+ }
69
+
70
+ .button {
71
+ width: 100%;
72
+ }
73
+ }
74
+
75
+ &[data-layout-type='mobile'] {
76
+ display: flex;
77
+ flex-direction: column;
78
+
79
+ .content {
80
+ padding: 16px;
81
+ }
82
+
83
+ .text {
84
+ gap: 4px;
85
+ }
86
+
87
+ .buttons {
88
+ flex-direction: column;
89
+ gap: 8px;
90
+ }
91
+
92
+ .button {
93
+ width: 100%;
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,17 @@
1
+ import { ValueOf } from '@snack-uikit/utils';
2
+
3
+ import { Appearance, Color } from './constants';
4
+
5
+ type ColorType = ValueOf<typeof Color>;
6
+
7
+ export type AppearanceType = ValueOf<typeof Appearance>;
8
+
9
+ export type WithColor = {
10
+ appearance: Exclude<AppearanceType, 'brand' | 'graphite'>;
11
+ color?: ColorType;
12
+ };
13
+
14
+ export type WithoutColor = {
15
+ appearance: Exclude<AppearanceType, 'decor'>;
16
+ color?: never;
17
+ };
@@ -0,0 +1,22 @@
1
+ import { LayoutType } from '@cloud-ru/uikit-product-utils';
2
+ import { TypographyProps } from '@snack-uikit/typography';
3
+
4
+ export const getBlockTitleProps = (layoutType: LayoutType): Pick<TypographyProps, 'purpose' | 'size'> => {
5
+ switch (layoutType) {
6
+ case 'mobile':
7
+ return {
8
+ purpose: 'title',
9
+ size: 'm',
10
+ };
11
+ case 'tablet':
12
+ return {
13
+ purpose: 'title',
14
+ size: 'l',
15
+ };
16
+ default:
17
+ return {
18
+ purpose: 'headline',
19
+ size: 'm',
20
+ };
21
+ }
22
+ };
@@ -0,0 +1,33 @@
1
+ import cn from 'classnames';
2
+ import { DetailedHTMLProps, HTMLAttributes, PropsWithChildren } from 'react';
3
+
4
+ import { ButtonPromoProps } from '@cloud-ru/uikit-product-button-predefined';
5
+ import { EridProps } from '@cloud-ru/uikit-product-site-tag';
6
+ import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
7
+
8
+ import { AppearanceType, WithColor, WithoutColor } from '../BannerCommon/types';
9
+ import styles from './styles.module.scss';
10
+
11
+ type DivProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
12
+
13
+ export type ColorWrapperProps = PropsWithChildren<
14
+ WithSupportProps<
15
+ {
16
+ className?: string;
17
+ } & (WithColor | WithoutColor)
18
+ >
19
+ >;
20
+
21
+ export function ColorWrapper({ id, className, children, color, appearance, ...other }: ColorWrapperProps & DivProps) {
22
+ return (
23
+ <div id={id} data-appearance={appearance} data-color={color} className={cn(styles.root, className)} {...other}>
24
+ {children}
25
+ </div>
26
+ );
27
+ }
28
+
29
+ ColorWrapper.getButtonAppearance = (appearance: AppearanceType): ButtonPromoProps['appearance'] =>
30
+ appearance !== 'graphite' ? 'secondary' : 'tertiary';
31
+
32
+ ColorWrapper.getEridAppearance = (appearance: AppearanceType): EridProps['appearance'] =>
33
+ appearance === 'graphite' ? 'invert-neutral' : 'neutral';
@@ -0,0 +1 @@
1
+ export * from './ColorWrapper';
@@ -0,0 +1,45 @@
1
+ @use '@sbercloud/figma-tokens-web/build/scss/styles-theme-variables' as var;
2
+
3
+ $colors: (
4
+ neutral: var.$sys-neutral-background,
5
+ white: var.$sys-neutral-background1-level,
6
+ violet: var.$sys-violet-background,
7
+ blue: var.$sys-blue-background,
8
+ );
9
+
10
+ $decor: 'decor';
11
+ $graphite: 'graphite';
12
+ $brand: 'brand';
13
+
14
+ @mixin decor-background-colors {
15
+ @each $color, $value in $colors {
16
+ &[data-color='#{$color}'][data-appearance='#{$decor}'] {
17
+ background-color: $value;
18
+ }
19
+ }
20
+ }
21
+
22
+ @mixin appearance {
23
+ &[data-appearance='#{$graphite}'] {
24
+ background-color: var.$sys-graphite-accent-default;
25
+
26
+ [data-color-wrapper-role=text] {
27
+ color: var.$sys-invert-neutral-text-main;
28
+ }
29
+ }
30
+
31
+ &[data-appearance='#{$brand}'] {
32
+ background-color: var.$sys-primary-accent-default;
33
+ }
34
+ }
35
+
36
+ .root {
37
+ background-color: var.$sys-neutral-background;
38
+
39
+ @include decor-background-colors;
40
+ @include appearance;
41
+ }
42
+
43
+ [data-color-wrapper-role=text] {
44
+ color: var.$sys-graphite-text-main;
45
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components';
package/src/types.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type BetterOmit<Type, Prop> = {
2
+ [Property in keyof Type as Exclude<Property, Prop>]: Type[Property];
3
+ };