Skip to content

Commit e4f48ef

Browse files
authored
fix font weight (#642)
* feat: add var font-weight * feat(Header): add fit view for media
1 parent 43d4e33 commit e4f48ef

File tree

10 files changed

+112
-4
lines changed

10 files changed

+112
-4
lines changed

src/blocks/Header/Header.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,21 @@ $backgroundWidth: 1440px;
193193
}
194194
}
195195

196+
&_media-view_fit {
197+
#{$block}__video > video,
198+
#{$block}__image {
199+
object-fit: contain;
200+
height: auto;
201+
width: auto;
202+
max-height: 100%;
203+
max-width: 100%;
204+
position: relative;
205+
top: 50%;
206+
left: 50%;
207+
transform: translate(-50%, -50%);
208+
}
209+
}
210+
196211
@media (max-width: $backgroundWidth) {
197212
&__background,
198213
&__background#{$block}__background_media {

src/blocks/Header/Header.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export const HeaderBlock = (props: WithChildren<HeaderBlockFullProps>) => {
7878
breadcrumbs,
7979
status,
8080
children,
81+
mediaView = 'full',
8182
} = props;
8283
const isMobile = useContext(MobileContext);
8384
const theme = useTheme();
@@ -97,7 +98,14 @@ export const HeaderBlock = (props: WithChildren<HeaderBlockFullProps>) => {
9798

9899
return (
99100
<header
100-
className={b({['has-media']: hasRightSideImage, ['full-width']: fullWidth}, className)}
101+
className={b(
102+
{
103+
['has-media']: hasRightSideImage,
104+
['full-width']: fullWidth,
105+
['media-view']: mediaView,
106+
},
107+
className,
108+
)}
101109
>
102110
{backgroundThemed && fullWidth && <FullWidthBackground background={backgroundThemed} />}
103111
{backgroundThemed && <Background background={backgroundThemed} isMobile={isMobile} />}

src/blocks/Header/__stories__/Header.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ There could be only one one Header block on the page.
4646

4747
`verticalOffset?: 's' | 'm' | 'l' | 'xl'` — Top and bottom offsets from the text. (Values: 's' - 48px, 'm' - 80px, 'l' - 112px, 'xl' - 144px.)
4848
</StoryTemplate>
49+
50+
`mediaView?: full | fit` — full is default value, the media content covers all widht and height. Fit - media content has real sizes and locates in the middle

src/blocks/Header/__stories__/Header.stories.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,26 @@ const ImageTemplate: StoryFn<HeaderBlockModel> = (args) => (
5858
</Fragment>
5959
);
6060

61+
const FitTemplate: StoryFn<HeaderBlockModel> = (args) => (
62+
<Fragment>
63+
<DefaultTemplate {...args} title={getImageTitle('«M»')} width="m" />
64+
<DefaultTemplate
65+
{...args}
66+
{...data.imageFit.content}
67+
title={getImageTitle('«S»')}
68+
width="s"
69+
/>
70+
<DefaultTemplate {...args} {...data.video.content} title={getImageTitle('«S»')} width="s" />
71+
<DefaultTemplate
72+
{...args}
73+
{...data.videoFit.content}
74+
title={getImageTitle('«S»')}
75+
width="s"
76+
description={yfmTransform(data.videoFit.description)}
77+
/>
78+
</Fragment>
79+
);
80+
6181
const VerticalOffsetTemplate: StoryFn<HeaderBlockModel> = (args) => (
6282
<Fragment>
6383
<DefaultTemplate {...args} title={getVerticalOffsetTitle('«S»')} verticalOffset="s" />
@@ -179,6 +199,7 @@ export const FullWithBackground = FullWithBackgroundTemplate.bind({});
179199
export const FullWidthMediaBackground = FullWidthMediaBackgroundTemplate.bind({});
180200
export const DarkTheme = DefaultTemplate.bind({});
181201
export const Breadcrumbs = BreadCrumbsTemplate.bind({});
202+
export const MediaViewFit = FitTemplate.bind({});
182203

183204
Default.args = {...DefaultArgs} as HeaderBlockProps;
184205

@@ -215,3 +236,9 @@ Breadcrumbs.args = {
215236
...DefaultArgs,
216237
...data.breadcrumbs.content,
217238
} as HeaderBlockProps;
239+
240+
MediaViewFit.args = {
241+
...DefaultArgs,
242+
...data.image.content,
243+
mediaView: 'fit',
244+
} as HeaderBlockProps;

src/blocks/Header/__stories__/data.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,57 @@
136136
}
137137
}
138138
},
139+
"imageFit": {
140+
"title": "Text size {{text}}",
141+
"content": {
142+
"width": "s",
143+
"image": {
144+
"light": {
145+
"src": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/header-img_6-12_light.png"
146+
},
147+
"dark": {
148+
"src": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/header-img_6-12_dark.png"
149+
}
150+
}
151+
}
152+
},
153+
"video": {
154+
"title": "Text size {{text}}",
155+
"content": {
156+
"width": "s",
157+
"video": {
158+
"light": {
159+
"src": [
160+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white_v.mp4"
161+
]
162+
},
163+
"dark": {
164+
"src": [
165+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white_v.mp4"
166+
]
167+
}
168+
}
169+
}
170+
},
171+
"videoFit": {
172+
"title": "Text size {{text}}",
173+
"description": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. **Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. **Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. **Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
174+
"content": {
175+
"width": "s",
176+
"video": {
177+
"light": {
178+
"src": [
179+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/main/new/podd-00-13-01.mp4"
180+
]
181+
},
182+
"dark": {
183+
"src": [
184+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/main/new/podd-00-13-01.mp4"
185+
]
186+
}
187+
}
188+
}
189+
},
139190
"size": {
140191
"title": "Header size {{size}}"
141192
}

src/blocks/Header/schema.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ export const HeaderProperties = {
4444
},
4545
image: withTheme(ImageProps),
4646
video: withTheme(VideoProps),
47+
mediaView: {
48+
type: 'string',
49+
enum: ['fit', 'full'],
50+
},
4751
backLink: {
4852
type: 'object',
4953
required: ['url', 'title'],

src/components/Table/Table.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $block: '.#{$ns}table';
1717
&__row {
1818
display: flex;
1919
&:first-child {
20-
font-weight: 500;
20+
font-weight: var(--g-text-accent-font-weight);
2121

2222
#{$root}__cell {
2323
border-bottom-color: var(--g-color-line-generic-active);

src/models/constructor-items/blocks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ export interface HeaderBlockProps {
148148
offset?: HeaderOffset;
149149
image?: ThemedImage;
150150
video?: ThemedMediaVideoProps;
151+
mediaView?: 'fit' | 'full';
151152
background?: ThemedHeaderBlockBackground;
152153
theme?: 'light' | 'dark';
153154
verticalOffset?: 's' | 'm' | 'l' | 'xl';

src/sub-blocks/PriceDetailed/PriceDescription/PriceDescription.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $block: '.#{$ns}price-description';
2323
}
2424

2525
&__main-title {
26-
font-weight: 500;
26+
font-weight: var(--g-text-accent-font-weight);
2727

2828
&_color_cornflower {
2929
color: var(--g-color-base-brand);

styles/yfm.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
}
5050

5151
p strong {
52-
font-weight: 500;
52+
font-weight: var(--g-text-accent-font-weight);
5353
}
5454

5555
&_size_s {

0 commit comments

Comments
 (0)