Skip to content

Commit c9b2f0b

Browse files
authored
Merge pull request #2 from imranhsayed/feature/add-footer
Feature/add footer
2 parents 96884ef + 156006e commit c9b2f0b

27 files changed

+1077
-84
lines changed

package-lock.json

+720-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
"scripts": {
66
"dev": "next dev",
77
"build": "next build",
8-
"start": "next start"
8+
"start": "next start",
9+
"svg": "svgr -d src/components/icons src/components/icons/svgs"
910
},
1011
"dependencies": {
12+
"@svgr/cli": "^5.5.0",
1113
"axios": "^0.21.1",
1214
"dompurify": "^2.3.1",
1315
"lodash": "^4.17.21",

pages/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import axios from 'axios';
1212

1313
export default function Home({data}) {
1414
const { header, footer } = data;
15+
1516
return (
1617
<div >
1718
<Header header={header}/>

src/components/icons/Bag.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as React from "react";
2+
3+
function SvgBag(props) {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
fill="none"
8+
viewBox="0 0 24 24"
9+
width={18}
10+
height="auto"
11+
stroke="currentColor"
12+
{...props}
13+
>
14+
<path d="M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z" />
15+
</svg>
16+
);
17+
}
18+
19+
export default SvgBag;

src/components/icons/BurgerIcon.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as React from "react";
2+
3+
function SvgBurgerIcon(props) {
4+
return (
5+
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" {...props}>
6+
<path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z" />
7+
</svg>
8+
);
9+
}
10+
11+
export default SvgBurgerIcon;

src/components/icons/Facebook.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as React from "react";
2+
3+
function SvgFacebook(props) {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
width={24}
8+
height={24}
9+
viewBox="0 0 18 18"
10+
{...props}
11+
>
12+
<path
13+
d="M2.637 18h5.87v-6.398H6.399v-2.11h2.11V6.855a2.64 2.64 0 012.637-2.636h2.636v2.11h-2.11c-.581 0-1.054.472-1.054 1.054v2.11h3.07l-.351 2.109h-2.719V18h4.746A2.64 2.64 0 0018 15.363V2.637A2.64 2.64 0 0015.363 0H2.637A2.64 2.64 0 000 2.637v12.726A2.64 2.64 0 002.637 18zM1.055 2.637c0-.871.71-1.582 1.582-1.582h12.726c.871 0 1.582.71 1.582 1.582v12.726c0 .871-.71 1.582-1.582 1.582h-3.691v-4.289h2.555l.703-4.219h-3.258V7.383h3.164V3.164h-3.691a3.696 3.696 0 00-3.692 3.691v1.582h-2.11v4.22h2.11v4.288H2.637c-.871 0-1.582-.71-1.582-1.582zm0 0"
14+
fill="#fff"
15+
/>
16+
</svg>
17+
);
18+
}
19+
20+
export default SvgFacebook;

src/components/icons/Instagram.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as React from "react";
2+
3+
function SvgInstagram(props) {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
width={24}
8+
height={24}
9+
viewBox="0 0 18 18"
10+
{...props}
11+
>
12+
<g fill="#fff">
13+
<path d="M2.637 18h12.726A2.64 2.64 0 0018 15.363V2.637A2.64 2.64 0 0015.363 0H2.637A2.64 2.64 0 000 2.637v12.726A2.64 2.64 0 002.637 18zM1.055 2.637c0-.871.71-1.582 1.582-1.582h12.726c.871 0 1.582.71 1.582 1.582v12.726c0 .871-.71 1.582-1.582 1.582H2.637c-.871 0-1.582-.71-1.582-1.582zm0 0" />
14+
<path d="M9 13.746A4.751 4.751 0 0013.746 9 4.751 4.751 0 009 4.254 4.751 4.751 0 004.254 9 4.751 4.751 0 009 13.746zM9 5.31A3.696 3.696 0 0112.691 9 3.696 3.696 0 019 12.691 3.696 3.696 0 015.309 9 3.696 3.696 0 019 5.309zm0 0M14.273 5.309c.872 0 1.582-.711 1.582-1.582 0-.872-.71-1.582-1.582-1.582-.87 0-1.582.71-1.582 1.582 0 .87.711 1.582 1.582 1.582zm0-2.11a.53.53 0 01.528.528.53.53 0 01-.528.527.53.53 0 01-.527-.527.53.53 0 01.527-.528zm0 0" />
15+
</g>
16+
</svg>
17+
);
18+
}
19+
20+
export default SvgInstagram;

src/components/icons/SearchIcon.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as React from "react";
2+
3+
function SvgSearchIcon(props) {
4+
return (
5+
<svg viewBox="0 0 24 24" {...props}>
6+
<path d="M10 4a6 6 0 100 12 6 6 0 000-12zm-8 6a8 8 0 1114.32 4.906l5.387 5.387a1 1 0 01-1.414 1.414l-5.387-5.387A8 8 0 012 10z" />
7+
</svg>
8+
);
9+
}
10+
11+
export default SvgSearchIcon;

src/components/icons/TailwindIcon.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import * as React from "react";
2+
3+
function SvgTailwindIcon(props) {
4+
return (
5+
<svg
6+
className="tailwind-icon_svg__fill-current tailwind-icon_svg__h-8 tailwind-icon_svg__w-8 tailwind-icon_svg__mr-2"
7+
width={54}
8+
height={54}
9+
xmlns="http://www.w3.org/2000/svg"
10+
{...props}
11+
>
12+
<path d="M13.5 22.1c1.8-7.2 6.3-10.8 13.5-10.8 10.8 0 12.15 8.1 17.55 9.45 3.6.9 6.75-.45 9.45-4.05-1.8 7.2-6.3 10.8-13.5 10.8-10.8 0-12.15-8.1-17.55-9.45-3.6-.9-6.75.45-9.45 4.05zM0 38.3c1.8-7.2 6.3-10.8 13.5-10.8 10.8 0 12.15 8.1 17.55 9.45 3.6.9 6.75-.45 9.45-4.05-1.8 7.2-6.3 10.8-13.5 10.8-10.8 0-12.15-8.1-17.55-9.45-3.6-.9-6.75.45-9.45 4.05z" />
13+
</svg>
14+
);
15+
}
16+
17+
export default SvgTailwindIcon;

src/components/icons/Twitter.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as React from "react";
2+
3+
function SvgTwitter(props) {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
width={24}
8+
height={24}
9+
viewBox="0 0 18 18"
10+
{...props}
11+
>
12+
<path
13+
d="M18 1.969c-1.133.05-1.11.047-1.234.058L17.434.11s-2.09.774-2.622.91C13.418-.233 11.348-.288 9.864.622 8.653 1.367 8 2.648 8.22 4.145 5.859 3.816 3.87 2.695 2.3.813L1.805.215l-.371.68a4.142 4.142 0 00-.442 2.773c.078.379.207.742.387 1.082l-.426-.164-.05.71c-.051.724.19 1.567.644 2.259.129.195.293.406.5.617l-.219-.031.27.816a3.957 3.957 0 002.039 2.36c-.953.402-1.719.66-2.98 1.074L0 12.773l1.066.582c.407.223 1.844.965 3.262 1.188 3.156.496 6.711.09 9.102-2.063 2.015-1.816 2.675-4.394 2.539-7.082-.02-.406.09-.793.312-1.093.45-.594 1.715-2.332 1.719-2.336zm-2.559 1.707a2.712 2.712 0 00-.523 1.777c.137 2.707-.602 4.809-2.191 6.246-1.864 1.672-4.864 2.332-8.235 1.801-.61-.094-1.242-.309-1.762-.523 1.06-.364 1.875-.688 3.196-1.313l1.84-.871-2.036-.129c-.972-.062-1.785-.535-2.28-1.305.265-.011.519-.054.773-.129l1.941-.539-1.957-.48a2.915 2.915 0 01-2.164-2.086c.195.05.422.09.793.125l1.809.18L3.21 5.313c-1.035-.81-1.45-2.02-1.145-3.184 3.227 3.348 7.012 3.094 7.395 3.183-.086-.816-.086-.816-.11-.894-.488-1.727.583-2.602 1.067-2.898 1.008-.622 2.605-.715 3.715.308a.95.95 0 00.867.23c.27-.066.496-.14.71-.218l-.452 1.3h.582c-.11.15-.242.325-.399.536zm0 0"
14+
fill="#fff"
15+
/>
16+
</svg>
17+
);
18+
}
19+
20+
export default SvgTwitter;

src/components/icons/User.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as React from "react";
2+
3+
function SvgUser(props) {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
fill="none"
8+
viewBox="0 0 24 24"
9+
width={18}
10+
height="auto"
11+
stroke="currentColor"
12+
{...props}
13+
>
14+
<path d="M16 7a4 4 0 11-8 0 4 4 0 018 0zm-4 7a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
15+
</svg>
16+
);
17+
}
18+
19+
export default SvgUser;

src/components/icons/Wishlist.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as React from "react";
2+
3+
function SvgWishlist(props) {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
fill="none"
8+
viewBox="0 0 24 24"
9+
width={18}
10+
height="auto"
11+
stroke="currentColor"
12+
{...props}
13+
>
14+
<path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" />
15+
</svg>
16+
);
17+
}
18+
19+
export default SvgWishlist;

src/components/icons/Youtube.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as React from "react";
2+
3+
function SvgYoutube(props) {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
width={24}
8+
height={24}
9+
viewBox="0 0 18 18"
10+
{...props}
11+
>
12+
<g fill="#fff">
13+
<path d="M2.637 13.71h12.726A2.64 2.64 0 0018 11.075V2.637A2.64 2.64 0 0015.363 0H2.637A2.64 2.64 0 000 2.637v8.437a2.64 2.64 0 002.637 2.637zM1.055 2.638c0-.871.71-1.582 1.582-1.582h12.726c.871 0 1.582.71 1.582 1.582v8.437c0 .871-.71 1.582-1.582 1.582H2.637c-.871 0-1.582-.71-1.582-1.582zm0 0" />
14+
<path d="M6.363 3.324v7.168l6.348-3.644zm1.055 1.79l3.144 1.75-3.144 1.804zm0 0" />
15+
</g>
16+
</svg>
17+
);
18+
}
19+
20+
export default SvgYoutube;

src/components/icons/index.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export { default as Bag } from './Bag'
2+
export { default as BurgerIcon } from './BurgerIcon'
3+
export { default as Facebook } from './Facebook'
4+
export { default as Instagram } from './Instagram'
5+
export { default as SearchIcon } from './SearchIcon'
6+
export { default as TailwindIcon } from './TailwindIcon'
7+
export { default as Twitter } from './Twitter'
8+
export { default as User } from './User'
9+
export { default as Wishlist } from './Wishlist'
10+
export { default as Youtube } from './Youtube'

src/components/icons/svgs/bag.svg

+5
Loading
Loading
+6
Loading
+8
Loading
Loading
Loading

src/components/icons/svgs/twitter.svg

+6
Loading

src/components/icons/svgs/user.svg

+5
Loading
+5
Loading

src/components/icons/svgs/youtube.svg

+7
Loading

src/components/layouts/footer/index.js

+64-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,68 @@
1-
const Footer = () => {
1+
/**
2+
* Internal Dependencies.
3+
*/
4+
import {sanitize} from '../../../utils/miscellaneous';
5+
import { getIconComponentByName } from '../../../utils/icons-map';
6+
7+
/**
8+
* External Dependencies.
9+
*/
10+
import {isEmpty, isArray} from 'lodash';
11+
import Link from 'next/link';
12+
13+
const Footer = ({footer}) => {
14+
15+
const { copyrightText, footerMenuItems, sidebarOne, sidebarTwo, socialLinks } = footer || {};
16+
217
return (
3-
<footer >
4-
<a
5-
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
6-
target="_blank"
7-
rel="noopener noreferrer"
8-
>
9-
Powered by{' '}
10-
</a>
18+
<footer className="bg-blue-500 p-6">
19+
<div className="container mx-auto">
20+
<div className="flex flex-wrap -mx-1 overflow-hidden text-white">
21+
{/*Widget One*/}
22+
<div className="my-1 px-1 w-full overflow-hidden sm:w-full lg:w-1/2 xl:w-1/3">
23+
<div dangerouslySetInnerHTML={{ __html: sanitize( sidebarOne ) }}/>
24+
</div>
25+
{/*Widget Two*/}
26+
<div className="my-1 px-1 w-full overflow-hidden sm:w-full lg:w-1/2 xl:w-1/3">
27+
<div dangerouslySetInnerHTML={{ __html: sanitize( sidebarTwo ) }}/>
28+
</div>
29+
30+
{/* Footer Menus*/}
31+
<div className="my-1 px-1 w-full overflow-hidden sm:w-full lg:w-1/2 xl:w-1/3">
32+
{ !isEmpty( footerMenuItems ) && isArray( footerMenuItems ) ? (
33+
<ul>
34+
{ footerMenuItems.map( menuItem => (
35+
<li key={menuItem?.ID}>
36+
<Link href={menuItem?.url ?? '/'}>
37+
<a>{menuItem?.title}</a>
38+
</Link>
39+
</li>
40+
)) }
41+
</ul>
42+
) : null }
43+
</div>
44+
</div>
45+
<div className="mb-8 mt-8 w-full flex flex-wrap">
46+
{/*Copyright Text*/}
47+
<div className="w-full md:w-1/2 lg:w-1/4 text-white">
48+
{ copyrightText ? copyrightText : '© Codeytek Academy 2021' }
49+
</div>
50+
<div className="w-full lg:w-3/4 flex justify-end">
51+
{ !isEmpty( socialLinks ) && isArray( socialLinks ) ? (
52+
<ul className="flex item-center">
53+
{ socialLinks.map( socialLink => (
54+
<li key={socialLink?.iconName} className="ml-4">
55+
<a href={ socialLink?.iconUrl || '/' } target="_blank" title={socialLink?.iconName}>
56+
{ getIconComponentByName( socialLink?.iconName ) }
57+
<span className="sr-only">{socialLink?.iconName}</span>
58+
</a>
59+
</li>
60+
) ) }
61+
</ul>
62+
) : null }
63+
</div>
64+
</div>
65+
</div>
1166
</footer>
1267
)
1368
}

0 commit comments

Comments
 (0)