Skip to content

Commit

Permalink
Created HOC wrapper for sections
Browse files Browse the repository at this point in the history
Signed-off-by: DeviousLab <deviouslab@gmail.com>
  • Loading branch information
DeviousLab committed May 13, 2022
1 parent 3ce728b commit fc6ba8c
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 2 deletions.
18 changes: 18 additions & 0 deletions frontend/src/components/Navigation.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'

const Navigation = ({ active }) => {
return (
<div className="app__navigation">
{['home', 'about', 'skills', 'work', 'testimonials', 'contact'].map((item, index) => (
<a
href={`#${item}`}
key={item+index}
className="app__navigation-dot"
style={active === item ? { backgroundColor: '#313bac' } : {}}
/>
))}
</div>
)
}

export default Navigation
21 changes: 21 additions & 0 deletions frontend/src/components/SocialMedia.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import { BsTwitter, BsInstagram } from 'react-icons/bs'
import { FaFacebookF } from 'react-icons/fa'

const SocialMedia = () => {
return (
<div className="app__social">
<div>
<BsTwitter />
</div>
<div>
<BsInstagram />
</div>
<div>
<FaFacebookF />
</div>
</div>
)
}

export default SocialMedia
3 changes: 3 additions & 0 deletions frontend/src/components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as Navigation } from './Navigation';
export { default as SocialMedia } from './SocialMedia';
export { default as Navbar } from '../components/Navbar/Navbar';
3 changes: 2 additions & 1 deletion frontend/src/containers/About/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { motion } from 'framer-motion'

import './About.scss'
import { urlFor, client } from '../../client'
import { AppWrap } from '../../wrapper'

const About = () => {
const [talents, setTalents] = useState([])
Expand Down Expand Up @@ -40,4 +41,4 @@ const About = () => {
)
}

export default About
export default AppWrap(About, 'about')
3 changes: 2 additions & 1 deletion frontend/src/containers/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { motion } from 'framer-motion'

import './Header.scss'
import { images } from '../../constants'
import { AppWrap } from '../../wrapper'

const scaleVariance = {
whileInView: {
Expand Down Expand Up @@ -67,4 +68,4 @@ const Header = () => {
}


export default Header
export default AppWrap(Header, 'home')
21 changes: 21 additions & 0 deletions frontend/src/wrapper/AppWrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import { Navigation, SocialMedia } from '../components'

const AppWrap = (Component, idName, classNames) => function HOC() {
return (
<div id={idName} className={`app__container ${classNames}`}>
<SocialMedia />
<div className="app__wrapper app__flex">
<Component />

<div className="copyright">
<p className="p-text">&copy;2022 MICAEL</p>
<p className="p-text">All rights reserved</p>
</div>
</div>
<Navigation active={idName} />
</div>
)
}

export default AppWrap
1 change: 1 addition & 0 deletions frontend/src/wrapper/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as AppWrap } from './AppWrap';

0 comments on commit fc6ba8c

Please sign in to comment.