Skip to content

Commit c647390

Browse files
committed
broken our homepage into smaller components, finished styling our menu-item component
1 parent 6aabf74 commit c647390

File tree

12 files changed

+191
-98
lines changed

12 files changed

+191
-98
lines changed

public/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1111
-->
1212
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
13+
<link
14+
href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300"
15+
rel="stylesheet"
16+
/>
1317
<!--
1418
Notice the use of %PUBLIC_URL% in the tags above.
1519
It will be replaced with the URL of the `public` folder during the build.

src/App.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-family: 'Open Sans Condensed';
3+
}

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import './App.css';
33

4-
import HomePage from './homepage.component';
4+
import HomePage from './pages/homepage/homepage.component';
55

66
function App() {
77
return (
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React from 'react';
2+
3+
import MenuItem from '../menu-item/menu-item.component';
4+
5+
import './directory.styles.scss';
6+
7+
class Directory extends React.Component {
8+
constructor() {
9+
super();
10+
11+
this.state = {
12+
sections: [
13+
{
14+
title: 'hats',
15+
imageUrl: 'https://i.ibb.co/cvpntL1/hats.png',
16+
id: 1
17+
},
18+
{
19+
title: 'jackets',
20+
imageUrl: 'https://i.ibb.co/px2tCc3/jackets.png',
21+
id: 2
22+
},
23+
{
24+
title: 'sneakers',
25+
imageUrl: 'https://i.ibb.co/0jqHpnp/sneakers.png',
26+
id: 3
27+
},
28+
{
29+
title: 'womens',
30+
imageUrl: 'https://i.ibb.co/GCCdy8t/womens.png',
31+
size: 'large',
32+
id: 4
33+
},
34+
{
35+
title: 'mens',
36+
imageUrl: 'https://i.ibb.co/R70vBrQ/men.png',
37+
size: 'large',
38+
id: 5
39+
}
40+
]
41+
};
42+
}
43+
44+
render() {
45+
return (
46+
<div className='directory-menu'>
47+
{this.state.sections.map(({ title, imageUrl, id, size }) => (
48+
<MenuItem key={id} title={title} imageUrl={imageUrl} size={size} />
49+
))}
50+
</div>
51+
);
52+
}
53+
}
54+
55+
export default Directory;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.directory-menu {
2+
width: 100%;
3+
display: flex;
4+
flex-wrap: wrap;
5+
justify-content: space-between;
6+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
3+
import './menu-item.styles.scss';
4+
5+
const MenuItem = ({ title, imageUrl, size }) => (
6+
<div className={`${size} menu-item`}>
7+
<div
8+
className='background-image'
9+
style={{
10+
backgroundImage: `url(${imageUrl})`
11+
}}
12+
/>
13+
<div className='content'>
14+
<h1 className='title'>{title.toUpperCase()}</h1>
15+
<span className='subtitle'>SHOP NOW</span>
16+
</div>
17+
</div>
18+
);
19+
20+
export default MenuItem;

src/homepage.styles.scss renamed to src/components/menu-item/menu-item.styles.scss

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
.homepage {
2-
display: flex;
3-
flex-direction: column;
4-
align-items: center;
5-
padding: 20px 80px;
6-
}
7-
8-
.directory-menu {
9-
width: 100%;
10-
display: flex;
11-
flex-wrap: wrap;
12-
justify-content: space-between;
13-
}
14-
151
.menu-item {
162
min-width: 30%;
173
height: 240px;
@@ -21,6 +7,24 @@
217
justify-content: center;
228
border: 1px solid black;
239
margin: 0 7.5px 15px;
10+
overflow: hidden;
11+
12+
&:hover {
13+
cursor: pointer;
14+
15+
& .background-image {
16+
transform: scale(1.1);
17+
transition: transform 6s cubic-bezier(0.25, 0.45, 0.45, 0.95);
18+
}
19+
20+
& .content {
21+
opacity: 0.9;
22+
}
23+
}
24+
25+
&.large {
26+
height: 380px;
27+
}
2428

2529
&:first-child {
2630
margin-right: 7.5px;
@@ -30,6 +34,13 @@
3034
margin-left: 7.5px;
3135
}
3236

37+
.background-image {
38+
width: 100%;
39+
height: 100%;
40+
background-size: cover;
41+
background-position: center;
42+
}
43+
3344
.content {
3445
height: 90px;
3546
padding: 0 25px;
@@ -38,10 +49,13 @@
3849
align-items: center;
3950
justify-content: center;
4051
border: 1px solid black;
52+
background-color: white;
53+
opacity: 0.7;
54+
position: absolute;
4155

4256
.title {
4357
font-weight: bold;
44-
margin-bottom: 6px;
58+
margin: 0 6px 0;
4559
font-size: 22px;
4660
color: #4a4a4a;
4761
}

src/homepage.component.jsx

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

src/index.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
body {
22
margin: 0;
33
padding: 0;
4-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
5-
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
4+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
5+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
66
sans-serif;
77
-webkit-font-smoothing: antialiased;
88
-moz-osx-font-smoothing: grayscale;
99
}
1010

1111
code {
12-
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
1313
monospace;
1414
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
3+
import Directory from '../../components/directory/directory.component';
4+
5+
import './homepage.styles.scss';
6+
7+
const HomePage = () => (
8+
<div className='homepage'>
9+
<Directory />
10+
</div>
11+
);
12+
13+
export default HomePage;

0 commit comments

Comments
 (0)