From dfc976b1b40219377e94e040c2cd65639cf83e7e Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Wed, 31 Aug 2022 16:02:00 -0400 Subject: [PATCH 1/8] ArrowLeftIcon component --- components/ArrowLeftIcon.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 components/ArrowLeftIcon.tsx diff --git a/components/ArrowLeftIcon.tsx b/components/ArrowLeftIcon.tsx new file mode 100644 index 0000000..da3e398 --- /dev/null +++ b/components/ArrowLeftIcon.tsx @@ -0,0 +1,13 @@ +import React from 'react' + +const ArrowLeftIcon = () => { + return ( +
+ + + +
+ ) +} + +export default ArrowLeftIcon \ No newline at end of file From e00f2d00bf0525900632ab78762f8edf72eb0839 Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Wed, 31 Aug 2022 16:02:10 -0400 Subject: [PATCH 2/8] disable eslintrc rule --- .eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.js b/.eslintrc.js index 2f27471..47bc536 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -110,6 +110,7 @@ module.exports = { 'react/jsx-indent': ['off'], 'react/jsx-indent-props': ['off'], 'react/jsx-one-expression-per-line': ['off'], + 'react/jsx-curly-newline': ['off'], 'react/no-array-index-key': ['off'], 'react/react-in-jsx-scope': ['off'], 'semi': ['off'], From bdefc1844c1f1fb8e40c8476142e6759b1993660 Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Wed, 31 Aug 2022 16:02:23 -0400 Subject: [PATCH 3/8] Add strings --- constants/strings.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/constants/strings.ts b/constants/strings.ts index 7f4f2da..fbf84da 100644 --- a/constants/strings.ts +++ b/constants/strings.ts @@ -50,4 +50,6 @@ export const APPLICATION_MAINTENANCE = 'Application Maintenance' export const WHICH_SERVICE_BEST_FITS = 'Which service(s) best fit(s) your project goals? Please select all that apply.' export const GIVE_US_BRIEF_DESCRIPTION = 'Give us brief description of your dream project, your business goals, and any other additional information you feel would be helpful' export const THANK_YOU = 'Thank You' -export const OUR_TEAM_WILL_CIONTACT_YOU = 'Our team will contact you shortly to set up your consultation' \ No newline at end of file +export const OUR_TEAM_WILL_CIONTACT_YOU = 'Our team will contact you shortly to set up your consultation' +export const GO_BACK_TO = 'Go back to' +export const HOME = 'Home' \ No newline at end of file From 11c1c12e05d1952632147bc313c1fc596de97ba8 Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Wed, 31 Aug 2022 16:02:47 -0400 Subject: [PATCH 4/8] Create GoBack component --- components/GoBack.tsx | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 components/GoBack.tsx diff --git a/components/GoBack.tsx b/components/GoBack.tsx new file mode 100644 index 0000000..c4e53bf --- /dev/null +++ b/components/GoBack.tsx @@ -0,0 +1,36 @@ +import React, { useState } from 'react'; +import ArrowLeftIcon from './ArrowLeftIcon'; +import Headline from './Headline'; + +import { + GO_BACK_TO, + PORTFOLIO, + HOME +} from '../constants/strings'; + +const GoBack = ({ + router +}: any) => { + + const [lastUrl, setLastUrl] = useState(router.includes('project') ? '/projects' : '/') + const [lastUrlName, setLastUrlName] = useState(router.includes('project') ? PORTFOLIO : HOME) + + return ( +
+ +
+
+ +
+
+ + {` ${GO_BACK_TO} ${lastUrlName} `} + +
+
+
+
+ ) +} + +export default GoBack \ No newline at end of file From 6c70c93df1bae2468abe1020b3d4fcc87ea931c1 Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Wed, 31 Aug 2022 16:02:58 -0400 Subject: [PATCH 5/8] Import GoBack component to layout --- components/layout.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/layout.tsx b/components/layout.tsx index f52cbfa..4d369e8 100644 --- a/components/layout.tsx +++ b/components/layout.tsx @@ -1,10 +1,23 @@ +import { useRouter } from 'next/router' import Navbar from './Navbar' import Footer from './Footer' +import Section from './Section' +import GoBack from './GoBack' export default function Layout({ children }: any) { + + const router = useRouter() + return ( <> + {!(router.pathname == '/' || router.pathname == '/projects') && + ( +
+ +
+ ) + }
{ children }
From 64eb99c96e0539f7006cff1afc2999c22f871864 Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Wed, 7 Sep 2022 15:03:18 -0400 Subject: [PATCH 6/8] Refactor strings --- constants/strings.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/constants/strings.ts b/constants/strings.ts index 345930d..30cc8be 100644 --- a/constants/strings.ts +++ b/constants/strings.ts @@ -53,5 +53,4 @@ export const THANK_YOU = 'Thank You' export const OUR_TEAM_WILL_CIONTACT_YOU = 'Our team will contact you shortly to set up your consultation' export const MIN = 'Min' export const MAX = 'Max' -export const GO_BACK_TO = 'Go back to' -export const HOME = 'Home' \ No newline at end of file +export const GO_BACK = 'Go back' \ No newline at end of file From 3c3e749e77824571f4cc4e3e74e9c2c66fbc5153 Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Wed, 7 Sep 2022 15:05:48 -0400 Subject: [PATCH 7/8] Refactor component --- components/GoBack.tsx | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/components/GoBack.tsx b/components/GoBack.tsx index c4e53bf..4073dff 100644 --- a/components/GoBack.tsx +++ b/components/GoBack.tsx @@ -1,34 +1,29 @@ -import React, { useState } from 'react'; +import React from 'react'; +import { useRouter } from 'next/router'; + import ArrowLeftIcon from './ArrowLeftIcon'; import Headline from './Headline'; import { - GO_BACK_TO, - PORTFOLIO, - HOME + GO_BACK, } from '../constants/strings'; -const GoBack = ({ - router -}: any) => { - - const [lastUrl, setLastUrl] = useState(router.includes('project') ? '/projects' : '/') - const [lastUrlName, setLastUrlName] = useState(router.includes('project') ? PORTFOLIO : HOME) +const GoBack = ({}) => { + const router = useRouter() + return ( -
- -
-
- -
-
- - {` ${GO_BACK_TO} ${lastUrlName} `} - -
+
) } From 1b3344126813c0739c7dd1f398913c8ba4293e1a Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Wed, 7 Sep 2022 15:30:21 -0400 Subject: [PATCH 8/8] Fix GoBack logic --- components/layout.tsx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/components/layout.tsx b/components/layout.tsx index 4d369e8..7ba2eb8 100644 --- a/components/layout.tsx +++ b/components/layout.tsx @@ -1,4 +1,6 @@ +import React from 'react' import { useRouter } from 'next/router' + import Navbar from './Navbar' import Footer from './Footer' import Section from './Section' @@ -7,17 +9,23 @@ import GoBack from './GoBack' export default function Layout({ children }: any) { const router = useRouter() + + const renderGoBack = () => { + if (!(router.pathname == '/' || router.pathname == '/projects')) { + return ( +
+ +
+ ) + } + } return ( <> - {!(router.pathname == '/' || router.pathname == '/projects') && - ( -
- -
- ) - } +
+ { renderGoBack() } +
{ children }