diff --git a/src/components/footer/contactValueContainer.tsx b/src/components/footer/contactValueContainer.tsx new file mode 100644 index 0000000..f21505e --- /dev/null +++ b/src/components/footer/contactValueContainer.tsx @@ -0,0 +1,42 @@ +import React, { useEffect, useState } from "react"; + +type TProps = { + type: 'a' | 'email' | 'phone' | 'text' + value: string + href?: string +} + +export const ContactValueContainer:React.FC = React.memo((props) => { + const [jsxValue, setJsxValue] = useState(<>); + + useEffect(() => { + switch(props.type) { + case 'a': + setJsxValue( + {props.value} + ) + break; + case 'email': + setJsxValue( + {props.value} + ) + break; + case 'phone': + setJsxValue( + {props.value} + ) + break; + case 'text': + setJsxValue( + {props.value} + ) + break; + } + }, [props.value, props.type, props?.href]) + + return
+ + {jsxValue} + +
+}) \ No newline at end of file diff --git a/src/components/footer/contactsContainer.tsx b/src/components/footer/contactsContainer.tsx index ceb2daf..8a65dae 100644 --- a/src/components/footer/contactsContainer.tsx +++ b/src/components/footer/contactsContainer.tsx @@ -1,5 +1,6 @@ import React, { useContext } from "react"; import { ContextLang } from "../ContextLang"; +import { ContactValueContainer } from "./contactValueContainer"; type TProps = { title: { @@ -8,17 +9,20 @@ type TProps = { } href?: string pairData: Array<{ - value1: { - ru: string, - en: string - } | string, - value2?: { - ru: string, - en: string - } | string + value1: ContactValueType + value2?: ContactValueType }> } +type ContactValueType = { + type: 'a' | 'email' | 'phone' | 'text' + value: { + ru: string, + en: string + } | string + href?: string +} + export const ContactContainer:React.FC = React.memo((props) => { const {lang} = useContext(ContextLang); return
@@ -28,13 +32,23 @@ export const ContactContainer:React.FC = React.memo((props) => {
{ props.href - ? {props.href} + // ? {props.href} + ? {props.href} : null }
{props.pairData.map(pair => { - return
-
+ return
+ + {/*
{ typeof(pair.value1) === 'string' @@ -46,8 +60,22 @@ export const ContactContainer:React.FC = React.memo((props) => { : pair.value1[lang] } -
+
*/} { + pair.value2?.type + ? + : null + } + + {/* { pair?.value2 ?
@@ -63,7 +91,7 @@ export const ContactContainer:React.FC = React.memo((props) => {
: null - } + } */}
})}
diff --git a/src/components/footer/footer.css b/src/components/footer/footer.css index f154aa4..9e08bb9 100644 --- a/src/components/footer/footer.css +++ b/src/components/footer/footer.css @@ -63,15 +63,21 @@ background-color: #979797; } +.contact-data-text { + +} + .contact-href, a { color: #FFFFFF; transition: .2s; + text-decoration: none; } .contact-href:hover, a:hover { color: #CE56C2; + text-decoration: underline; transition: .2s; } diff --git a/src/components/footer/footer.tsx b/src/components/footer/footer.tsx index 8c6affd..cb14b41 100644 --- a/src/components/footer/footer.tsx +++ b/src/components/footer/footer.tsx @@ -12,11 +12,38 @@ export const Footer:React.FC = React.memo(() => {
@@ -24,15 +51,47 @@ export const Footer:React.FC = React.memo(() => {