Skip to content

Commit

Permalink
feat: create HomeHeader component
Browse files Browse the repository at this point in the history
  • Loading branch information
arnest00 committed Oct 29, 2022
1 parent 5780b5d commit dd19f3d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
// for example media object known from OOCSS.
@import 'scss/objects/review-page';
@import 'scss/objects/homepage';
@import 'scss/objects/home-header';

// =====================================================================
// 6. Components
Expand All @@ -79,7 +80,6 @@
@import 'scss/components/subtitle';
@import 'scss/components/location-new';
@import 'scss/components/location-select';
@import 'scss/components/place-new';

// =====================================================================
// 7. Vendors
Expand Down
25 changes: 25 additions & 0 deletions src/components/HomeHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Subtitle from './Subtitle';
import LocationSelect from './LocationSelect';
import { Location } from '../types/sparkeats';

type HomeHeaderProps = {
locations: Location[];
};

function HomeHeader({ locations }: HomeHeaderProps) {
return (
<div className="home-header">
<Subtitle />

<LocationSelect locations={locations} />

<div className="home-header__button">
<a className="button__header-primary" href="/places/new">
Add a Review
</a>
</div>
</div>
);
}

export default HomeHeader;
3 changes: 2 additions & 1 deletion src/components/home/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import HomeHeader from '../HomeHeader';
import { LocationCards } from './LocationCards';
import type { Location } from '../../types/sparkeats';

export function HomePage({ locations }: { locations: Location[] }) {
return (
<div className="homepage">
<header>Home Header</header>
<HomeHeader locations={locations} />
<LocationCards locations={locations} />
</div>
);
Expand Down
12 changes: 12 additions & 0 deletions src/scss/objects/_home-header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.home-header {
margin: 4rem auto 5rem auto;
width: 80%;

&__button {
margin-top: 2rem;

@media (min-width: 64rem) {
width: 33%;
}
}
}
5 changes: 0 additions & 5 deletions src/scss/objects/_homepage.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
.homepage {
padding-top: 1px;

&__header {
margin: 4rem auto 5rem;
width: 80%;
}

&__cards {
margin: 2rem auto 4rem;
width: 80%;
Expand Down

0 comments on commit dd19f3d

Please sign in to comment.