Skip to content

Commit c400c5d

Browse files
donysukardiCompuIves
authored andcommitted
Improve Features section's layout (codesandbox#676)
* Update Features layout * Remove unnecessary PureComponent * Use explicit border-width
1 parent 6354552 commit c400c5d

File tree

4 files changed

+48
-18
lines changed

4 files changed

+48
-18
lines changed

packages/homepage/src/screens/home/Animation/Cubes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const SmallCube = styled(
5151
const OFFSETS = [84, 32, 54, 110];
5252

5353
// eslint-disable-next-line react/no-multi-comp
54-
export default class Cubes extends React.PureComponent {
54+
export default class Cubes extends React.Component {
5555
els = {};
5656

5757
constructor(props) {

packages/homepage/src/screens/home/ExtraFeatures/Feature.js

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,43 @@ import styled from 'styled-components';
44
import media from '../../../utils/media';
55

66
const Container = styled.div`
7-
display: flex;
8-
flex-direction: column;
97
position: relative;
10-
11-
align-items: center;
12-
text-align: center;
13-
148
color: white;
9+
padding: 1.5rem 1rem;
10+
border: 0 solid rgba(255, 255, 255, 0.12);
11+
border-top-width: 1px;
1512
16-
margin: 1rem;
13+
&:first-child {
14+
border-top-width: 0;
15+
}
1716
18-
width: calc(25% - 2rem);
17+
${media.fromTablet`
18+
width: calc(50%);
19+
border-right-width: 1px;
1920
20-
${media.tablet`
21-
width: calc(50% - 2rem);
21+
&:nth-child(-n+2) {
22+
border-top-width: 0;
23+
}
24+
25+
&:nth-child(2n) {
26+
border-right-width: 0;
27+
}
2228
`};
2329
24-
${media.phone`
25-
width: 100%;
30+
${media.fromDesktop`
31+
width: calc(25%);
32+
33+
&:nth-child(2n) {
34+
border-right-width: 1px;
35+
}
36+
37+
&:nth-child(-n+4) {
38+
border-top-width: 0;
39+
}
40+
41+
&:nth-child(4n) {
42+
border-right-width: 0;
43+
}
2644
`};
2745
2846
svg {
@@ -64,8 +82,8 @@ const Description = styled.div`
6482

6583
const NewBadge = styled.div`
6684
position: absolute;
67-
top: -0.9rem;
68-
right: 5.2rem;
85+
top: 1.25rem;
86+
left: 3.6rem;
6987
padding: 0 5px;
7088
background-image: linear-gradient(
7189
45deg,
@@ -83,8 +101,8 @@ const NewBadge = styled.div`
83101
const PatronBadge = styled.a`
84102
display: block;
85103
position: absolute;
86-
top: -0.9rem;
87-
right: 4.2rem;
104+
top: 1.25rem;
105+
left: 3.6rem;
88106
padding: 0 5px;
89107
background-image: linear-gradient(-225deg, #ffc766 0%, #f6b053 100%);
90108

packages/homepage/src/screens/home/ExtraFeatures/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default () => (
4040
<Centered horizontal>
4141
<Heading>There{"'"}s more</Heading>
4242
<SubHeading>
43-
This was just the tip of the iceberg. There are many more things to
43+
This is just the tip of the iceberg. There are many more things to
4444
explore, if you are missing anything you can always open an issue on{' '}
4545
<a
4646
style={{ color: 'white' }}

packages/homepage/src/utils/media.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,16 @@ export default {
1212
${css(...args)};
1313
}
1414
`,
15+
16+
fromTablet: (...args) => css`
17+
@media (min-width: 660px) {
18+
${css(...args)};
19+
}
20+
`,
21+
22+
fromDesktop: (...args) => css`
23+
@media (min-width: 1280px) {
24+
${css(...args)};
25+
}
26+
`,
1527
};

0 commit comments

Comments
 (0)