Skip to content

Commit 5809e6b

Browse files
author
Juli Ovechkina
authored
fix(Tabs): padding and image props (#77)
1 parent 4a5be41 commit 5809e6b

File tree

5 files changed

+28
-21
lines changed

5 files changed

+28
-21
lines changed

src/blocks/Tabs/Tabs.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ $block: '.#{$ns}tabs-block';
1010
margin-bottom: $indentSM;
1111

1212
&_centered {
13-
display: flex;
14-
justify-content: center;
15-
flex-wrap: wrap;
16-
margin-left: auto;
17-
margin-right: auto;
1813
text-align: center;
14+
15+
& > * {
16+
margin: 0 auto;
17+
}
1918
}
2019
}
2120

src/components/Image/Image.scss

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/components/Image/Image.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ import React, {CSSProperties, MouseEventHandler, useContext, useState, Fragment}
22
import {ProjectSettingsContext} from '../../context/projectSettingsContext';
33
import {BREAKPOINTS} from '../../constants';
44
import {ImageDeviceProps, ImageObjectProps} from '../../models';
5-
import {block} from '../../utils';
6-
7-
import './Image.scss';
8-
9-
const b = block('image');
105

116
export interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDeviceProps> {
127
style?: CSSProperties;
138
className?: string;
149
onClick?: MouseEventHandler;
10+
containerClassName?: string;
1511
}
1612

1713
const checkWebP = (src: string) => {
@@ -20,7 +16,18 @@ const checkWebP = (src: string) => {
2016

2117
const Image = (props: ImageProps) => {
2218
const projectSettings = useContext(ProjectSettingsContext);
23-
const {src, alt, disableCompress, tablet, desktop, mobile, style, className, onClick} = props;
19+
const {
20+
src,
21+
alt,
22+
disableCompress,
23+
tablet,
24+
desktop,
25+
mobile,
26+
style,
27+
className,
28+
onClick,
29+
containerClassName,
30+
} = props;
2431
const [imgLoadingError, setImgLoadingError] = useState(false);
2532

2633
const imageSrc = src || desktop;
@@ -37,7 +44,7 @@ const Image = (props: ImageProps) => {
3744
imgLoadingError;
3845

3946
return (
40-
<picture className={b()}>
47+
<picture className={containerClassName}>
4148
{mobile && (
4249
<Fragment>
4350
{!disableWebp && (

src/components/VideoBlock/VideoBlock.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ $block: '.#{$ns}VideoBlock';
2222
height: 100%;
2323
object-fit: cover;
2424
display: block;
25+
26+
&-wrapper {
27+
height: 100%;
28+
width: 100%;
29+
}
2530
}
2631

2732
&__button {

src/components/VideoBlock/VideoBlock.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ const VideoBlock = (props: VideoBlockProps) => {
125125
<div className={b(null, className)} ref={ref} style={{height: currentHeight}}>
126126
{previewImg && !hidePreview && (
127127
<div className={b('preview')} onClick={onPreviewClick}>
128-
<Image src={previewImg} className={b('image')} />
128+
<Image
129+
src={previewImg}
130+
className={b('image')}
131+
containerClassName={b('image-wrapper')}
132+
/>
129133
{playButton || (
130134
<button className={b('button')}>
131135
<Icon className={b('icon')} data={PlayVideo} size={24} />

0 commit comments

Comments
 (0)