From 2b8d1b110de9abc5b9f7e1f20b09f6710629be4c Mon Sep 17 00:00:00 2001 From: Johanna Leonsson Date: Tue, 6 Jun 2023 12:50:41 +0200 Subject: [PATCH] added lib for reusable components and a section for housing choises --- src/App.js | 2 ++ src/components/LocationLink.js | 26 +++++++++++++++++++++++ src/components/lib/Button.js | 23 ++++++++++++++++++++ src/components/lib/LinkCard.js | 39 ++++++++++++++++++++++++++++++++++ src/components/search.js | 21 +++++------------- 5 files changed, 95 insertions(+), 16 deletions(-) create mode 100644 src/components/LocationLink.js create mode 100644 src/components/lib/Button.js create mode 100644 src/components/lib/LinkCard.js diff --git a/src/App.js b/src/App.js index c38a699..10087b5 100644 --- a/src/App.js +++ b/src/App.js @@ -2,12 +2,14 @@ import React from 'react'; import { Nav } from 'components/nav'; import { Footer } from 'components/footer'; import StartPage from 'components/StartPage'; +import { LocationSection } from 'components/LocationLink'; export const App = () => { return (
); diff --git a/src/components/LocationLink.js b/src/components/LocationLink.js new file mode 100644 index 0000000..d637f51 --- /dev/null +++ b/src/components/LocationLink.js @@ -0,0 +1,26 @@ +import React from 'react'; +import { LocationImg } from './lib/LinkCard' + +export const LocationSection = () => { + return ( +
+ + + + + +
+ ) +} diff --git a/src/components/lib/Button.js b/src/components/lib/Button.js new file mode 100644 index 0000000..90313bb --- /dev/null +++ b/src/components/lib/Button.js @@ -0,0 +1,23 @@ +import React from 'react'; +import styled from 'styled-components'; + +const FadeButton = styled.button` + position: relative; + border: 1px solid black; + background-color: transparent; + padding: 8px 20px; + font-size: 16px; + cursor: pointer; + transition: background-color 0.3s; + + &:hover { + background-color: black; + color: white; + } +`; + +const Button = ({ text }) => { + return {text}; +}; + +export default Button; diff --git a/src/components/lib/LinkCard.js b/src/components/lib/LinkCard.js new file mode 100644 index 0000000..4707460 --- /dev/null +++ b/src/components/lib/LinkCard.js @@ -0,0 +1,39 @@ +import React from 'react'; +import styled from 'styled-components'; + +const OverlayText = styled.div` + position: relative; + display: inline-block; +`; + +const LinkImage = styled.img` + width: 100%; + max-width: 350px; + height: 100%; + margin: 10px; +`; + +const LocationText = styled.div` + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + padding: 10px 5rem; + background-color: rgba(255, 255, 255, 0.8); + color: #414142; + font-size: 14px; + text-transform: uppercase; + white-space: nowrap; +`; + +export const LocationImg = ({ src, alt, ariaLabel, locationText }) => { + return ( + + + + {locationText} + + + ); +}; + diff --git a/src/components/search.js b/src/components/search.js index 551a9ed..6a60897 100644 --- a/src/components/search.js +++ b/src/components/search.js @@ -2,6 +2,7 @@ // IMPORT MODULES import React, { useState } from 'react'; import styled from 'styled-components'; +import Button from './lib/Button' // COMPONENT @@ -42,7 +43,9 @@ export const Search = () => { placeholder="Search..." value={searchTerm} onChange={handleSearchChange} /> - +