@cloud-ru/ds-site-card-vacancy 1.0.0

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,129 @@
1
+ @use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
2
+ @use '@cloud-ru/ds-materials' as m;
3
+
4
+ .background {
5
+ pointer-events: none;
6
+
7
+ position: absolute;
8
+ inset: 0;
9
+
10
+ overflow: hidden;
11
+
12
+ border-radius: inherit;
13
+ }
14
+
15
+ .stateLayer {
16
+ pointer-events: none;
17
+ position: absolute;
18
+ inset: 0;
19
+ border-radius: inherit;
20
+ }
21
+
22
+ .content {
23
+ position: relative;
24
+ z-index: 1;
25
+
26
+ display: flex;
27
+ flex: 1 0 0;
28
+ flex-direction: column;
29
+ align-items: flex-start;
30
+ justify-content: space-between;
31
+
32
+ min-width: 0;
33
+
34
+ overflow-wrap: break-word;
35
+ }
36
+
37
+ .title {
38
+ overflow: hidden;
39
+ display: -webkit-box;
40
+ -webkit-box-orient: vertical;
41
+ -webkit-line-clamp: 2;
42
+
43
+ width: 100%;
44
+ min-width: 0;
45
+
46
+ text-overflow: ellipsis;
47
+ }
48
+
49
+ .description {
50
+ overflow: hidden;
51
+
52
+ width: 100%;
53
+ min-width: 0;
54
+
55
+ text-overflow: ellipsis;
56
+ white-space: nowrap;
57
+ }
58
+
59
+ .cardVacancy {
60
+ cursor: pointer;
61
+
62
+ position: relative;
63
+
64
+ display: flex;
65
+
66
+ box-sizing: border-box;
67
+ width: 100%;
68
+ min-height: 160px;
69
+ margin: 0;
70
+ padding: base.$sn-primitive-dimension-24;
71
+ border: none;
72
+
73
+ font-family: inherit;
74
+ text-align: left;
75
+ text-decoration: none;
76
+
77
+ background: transparent;
78
+ outline: 0;
79
+ outline-offset: 0;
80
+
81
+ &[data-mobile] {
82
+ min-height: 120px;
83
+ }
84
+
85
+ &:focus-visible {
86
+ outline: base.$sn-primitive-strokeWeight-strokeSemiBold solid base.$sn-theme-color-available-complementary;
87
+ outline-offset: calc(#{base.$sn-primitive-strokeWeight-strokeSemiBold} * -1);
88
+ }
89
+
90
+ &:active {
91
+ outline: none;
92
+ }
93
+
94
+ &[data-appearance='neutral'] {
95
+ color: base.$sn-theme-color-available-version-textMain;
96
+
97
+ .background {
98
+ background-color: base.$sn-theme-color-neutral-decorTransparent;
99
+ }
100
+
101
+ .description {
102
+ color: base.$sn-theme-color-available-version-textDisabled;
103
+ }
104
+ }
105
+
106
+ &[data-appearance='primary'] {
107
+ color: base.$sn-theme-color-primary-onAccent;
108
+
109
+ .background {
110
+ background-color: base.$sn-theme-color-primary-accent;
111
+
112
+ &::after {
113
+ content: '';
114
+ position: absolute;
115
+ inset: 0;
116
+ background-image: repeating-radial-gradient(
117
+ circle at 0% calc(100% + #{base.$sn-primitive-dimension-24}),
118
+ transparent 0,
119
+ transparent calc(#{base.$sn-primitive-dimension-32} - #{base.$sn-primitive-strokeWeight-strokeBold}),
120
+ base.$sn-theme-color-primary-text
121
+ calc(#{base.$sn-primitive-dimension-32} - #{base.$sn-primitive-strokeWeight-strokeBold}),
122
+ base.$sn-theme-color-primary-text base.$sn-primitive-dimension-32
123
+ );
124
+ }
125
+ }
126
+ }
127
+
128
+ @include m.has-state-layer-as-child(#{stateLayer});
129
+ }
package/src/types.ts ADDED
@@ -0,0 +1,35 @@
1
+ import { ValueOf, WithSupportProps } from '@cloud-ru/ds-utils';
2
+ import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType } from 'react';
3
+
4
+ import { APPEARANCE } from './constants';
5
+
6
+ export type PolymorphicRef<T extends ElementType> = ComponentPropsWithRef<T>['ref'];
7
+
8
+ export type Appearance = ValueOf<typeof APPEARANCE>;
9
+
10
+ type BaseCardVacancyProps = {
11
+ /** Заголовок вакансии. Обрезается многоточием, если не помещается в одну строку. */
12
+ title?: string;
13
+ /** Описание под заголовком. Обрезается многоточием, если не помещается в одну строку. */
14
+ description?: string;
15
+ /**
16
+ * Визуальный вид карточки:
17
+ *
18
+ * - `neutral` — нейтральный полупрозрачный фон, тёмный заголовок.
19
+ * - `primary` — акцентный фон `primary` с декоративным паттерном, текст `onAccent`.
20
+ */
21
+ appearance?: Appearance;
22
+ /** Компактная мобильная версия — меньшая высота и более мелкая типографика. */
23
+ mobile?: boolean;
24
+ /** CSS-класс корневого элемента. */
25
+ className?: string;
26
+ };
27
+
28
+ export type CardVacancyProps<T extends ElementType = 'a'> = WithSupportProps<
29
+ BaseCardVacancyProps & {
30
+ /** Полиморфный тег корня — `'a'` по умолчанию (карточка-ссылка), либо роутерный `Link` / `'button'` / `'div'`. */
31
+ as?: T;
32
+ /** Ref на корневой элемент. */
33
+ innerRef?: PolymorphicRef<T>;
34
+ } & Omit<ComponentPropsWithoutRef<T>, keyof BaseCardVacancyProps | 'as' | 'ref'>
35
+ >;