Skip to content

Commit 04b253e

Browse files
committed
fix styles for mobile using flexbox
1 parent ba55cf0 commit 04b253e

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

src/patterns/atoms/color/css/color.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
.a-color__preview {
1111
display: block;
1212
height: 150px;
13-
width: 150px;
13+
min-width: 150px;
14+
width: 100%;
1415
}
1516

1617
.a-color__code {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.h-image-block {
2-
margin: 30px 60px;
2+
margin: 30px;
33
display: inline-block;
44
}

src/patterns/atoms/image/index.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ export interface IImageBlock {
1414
description?: string;
1515
}
1616

17-
const RENDITION_BASE_SIZE = 50;
17+
const RENDITION_BASE_SIZE = 35;
1818

1919
const calculateRenditions = (rendition: ImageRendition): number[] => {
20-
return rendition
21-
.split(':')
22-
.map((size: string) => parseInt(size, 10))
23-
.map((size: number) => (size >= 9 ? size / 2 : size))
24-
.map((size: number) => size * RENDITION_BASE_SIZE);
20+
const renditions = rendition
21+
.split(':') // 1:1 => ['1', '1']
22+
.map((size: string) => parseInt(size, 10)) // ['1', '1'] => [1, 1]
23+
.map((size: number) => size * RENDITION_BASE_SIZE); // [1, 1] => [35, 35]
24+
25+
return renditions.map((size: number) => size * (100 / (renditions[0] + renditions[1])) * 5);
2526
};
2627

2728
export const Image = ({ rendition, modifier }: IImage) => {
@@ -31,6 +32,7 @@ export const Image = ({ rendition, modifier }: IImage) => {
3132
<div className={`a-image` + (modifier ? ` a-image--${modifier}` : '')} style={{ width, height }}>
3233
<p className="a-image__rendition" style={{ lineHeight: `${height}px` }}>
3334
{rendition}
35+
{modifier && ` (${modifier})`}
3436
</p>
3537
</div>
3638
);

src/patterns/molecules/colors/css/colors.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
.m-colors .a-color {
88
margin: 20px;
9-
flex-shrink: 1;
9+
flex-shrink: 0;
10+
flex-grow: 1;
1011
flex-basis: auto;
1112
align-self: auto;
1213
}

0 commit comments

Comments
 (0)