Skip to content

Commit

Permalink
broken homepage into smaller components and finishing styling our men…
Browse files Browse the repository at this point in the history
…u-item
  • Loading branch information
samilabud committed Nov 4, 2020
1 parent 89efc47 commit 69a94d0
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 133 deletions.
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
name="description"
content="Web site created using create-react-app"
/>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&display=swap" rel="stylesheet">
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
Expand Down
41 changes: 3 additions & 38 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,3 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
body{
font-family: 'Open Sans Condensed';
}
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import './homepage.styles.scss';
import HomePage from './homepage.component'
import HomePage from './pages/homepage/homepage.component'
import './App.css';
function App() {
return (
<div>
Expand Down
60 changes: 60 additions & 0 deletions src/components/directory/directory.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React from 'react';
import MenuItem from '../menu-item/menu-items.component';
import './directory.styles.scss';

class Directory extends React.Component {
constructor(){
super();
this.state = {
sections : [
{
title: 'hats',
imageUrl: 'https://i.ibb.co/cvpntL1/hats.png',
id: 1,
linkUrl: 'shop/hats'
},
{
title: 'jackets',
imageUrl: 'https://i.ibb.co/px2tCc3/jackets.png',
id: 2,
linkUrl: 'shop/jackets'
},
{
title: 'sneakers',
imageUrl: 'https://i.ibb.co/0jqHpnp/sneakers.png',
id: 3,
linkUrl: 'shop/sneakers'
},
{
title: 'womens',
imageUrl: 'https://i.ibb.co/GCCdy8t/womens.png',
size: 'large',
id: 4,
linkUrl: 'shop/womens'
},
{
title: 'mens',
imageUrl: 'https://i.ibb.co/R70vBrQ/men.png',
size: 'large',
id: 5,
linkUrl: 'shop/mens'
}
]
}
}
render(){
return(
<div className='directory-menu'>
{
this.state.sections.map(({title,imageUrl,size,id,linkUrl})=>(
<MenuItem key={id} title={title} imageUrl={imageUrl} size={size} />
))
}

</div>
)
}

}

export default Directory;
7 changes: 7 additions & 0 deletions src/components/directory/directory.styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.directory-menu {
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}

15 changes: 15 additions & 0 deletions src/components/menu-item/menu-items.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import './menu-items.styles.scss';

const MenuItem = ({title,imageUrl, size}) => (
<div className={`${size} menu-item`}>
<div className='background-image' style={{backgroundImage:`url(${imageUrl})`}}></div>
<div className='content'>
<h1 className='title'>{title.toUpperCase()}</h1>
<span className='subtitle'>SHOP NOW</span>
</div>
</div>

);

export default MenuItem;
61 changes: 61 additions & 0 deletions src/components/menu-item/menu-items.styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.menu-item {
min-width: 30%;
height: 240px;
flex: 1 1 auto;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid black;
margin: 0 7.5px 15px;
overflow: hidden;
&:hover{
cursor: pointer;
& .background-image{
transform: scale(1.1);
transition:transform 6s cubic-bezier(0.25, 0.45, 0.45, 0.95);
}
}
&.large{
height: 380px;
}

&:first-child {
margin-right: 7.5px;
}

&:last-child {
margin-left: 7.5px;
}
.background-image{
width: 100%;
height: 100%;
background-position: center;
background-size: cover;

}
.content {
height: 90px;
padding: 0 25px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border: 1px solid black;
background-color: white;
opacity: 0.7;
position: absolute;

.title {
font-weight: bold;
margin-bottom: 6px;
font-size: 22px;
color: #4a4a4a;
}

.subtitle {
font-weight: lighter;
font-size: 16px;
}
}
}

39 changes: 0 additions & 39 deletions src/homepage.component.jsx

This file was deleted.

54 changes: 0 additions & 54 deletions src/homepage.styles.scss

This file was deleted.

10 changes: 10 additions & 0 deletions src/pages/homepage/homepage.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import Directory from '../../components/directory/directory.component';
import './homepage.styles.scss';

const HomePage = () => (
<div className='homepage'>
<Directory/>
</div>
)
export default HomePage;
6 changes: 6 additions & 0 deletions src/pages/homepage/homepage.styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.homepage {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px 80px;
}

0 comments on commit 69a94d0

Please sign in to comment.