11import { PolicyContent } from "./PolicyContent"
22import { Button , Stack , Container , Image , Row , Col } from "react-bootstrap"
3- import { ButtonHTMLAttributes , useEffect , useState } from "react"
43import style from "./PolicyPage.module.css"
54import Router from "next/router"
65import classNames from "classnames"
6+ import { useTranslation } from "next-i18next"
77
8- const policies = [ "copyright " , "privacy-policy " , "code-of-conduct" ] as const
8+ const policies = [ "privacy-policy " , "copyright " , "code-of-conduct" ] as const
99export type Policy = ( typeof policies ) [ number ]
1010
1111export default function PolicyPage ( {
1212 policy = "privacy-policy"
1313} : {
1414 policy ?: Policy
1515} ) {
16- const handleOnClick = ( p : Policy ) => {
17- Router . push ( `/policies/${ p } ` )
18- }
19-
16+ const { t } = useTranslation ( "policies" )
2017 return (
2118 < Container fluid className = { style . policyContent } >
22- < h1 > Policies </ h1 >
19+ < h1 > { t ( "title" ) } </ h1 >
2320 < Stack direction = "horizontal" >
24- < Button
25- className = { `${
26- style [ policy === "privacy-policy" ? "currentTab" : "tab" ]
27- } `}
28- id = "privacy-policy"
29- onClick = { e => handleOnClick ( "privacy-policy" ) }
30- >
31- Privacy < br /> Policy
32- </ Button >
33- < Button
34- className = { `${ style [ policy === "copyright" ? "currentTab" : "tab" ] } ` }
35- id = "copyright"
36- onClick = { e => handleOnClick ( "copyright" ) }
37- >
38- Terms of Service < br />
39- </ Button >
40-
41- < Button
42- className = { `${
43- style [ policy === "code-of-conduct" ? "currentTab" : "tab" ]
44- } `}
45- id = "code-of-conduct"
46- onClick = { e => handleOnClick ( "code-of-conduct" ) }
47- >
48- Code of < br /> Conduct
49- </ Button >
21+ { policies . map ( p => (
22+ < Button
23+ className = { `${ style [ policy === p ? "currentTab" : "tab" ] } ` }
24+ id = { p }
25+ key = { p }
26+ onClick = { ( ) => Router . push ( `/policies/${ p } ` ) }
27+ >
28+ { t ( `tabs.${ p } ` ) }
29+ </ Button >
30+ ) ) }
5031 </ Stack >
5132
5233 < PolicyContent policy = { policy } />
5334
5435 < div className = { style . sharedValues } >
55- < p className = { style . subHeading } > Our Shared Values </ p >
36+ < p className = { style . subHeading } > { t ( "values.heading" ) } </ p >
5637 < hr className = { style . bottomBorder } > </ hr >
57- < p className = { style . text1 } >
58- How we interact with each other determines what we can accomplish
59- </ p >
60- < p className = { style . text2 } > On this website, we ask you to act with:</ p >
38+ < p className = { style . text1 } > { t ( "values.description1" ) } </ p >
39+ < p className = { style . text2 } > { t ( "values.description2" ) } </ p >
6140 </ div >
6241
6342 < Container fluid >
@@ -71,19 +50,19 @@ export default function PolicyPage({
7150 >
7251 < Col xs = { 12 } className = { style . blueBox } >
7352 < Image src = "/handShake.jpg" alt = "" className = { style . symbol } > </ Image >
74- < p className = { style . values } > Humility </ p >
53+ < p className = { style . values } > { t ( "values.humility" ) } </ p >
7554 </ Col >
7655 < Col xs = { 12 } className = { style . blueBox } >
7756 < Image
7857 src = "/compassion.png"
7958 alt = ""
8059 className = { style . symbol }
8160 > </ Image >
82- < p className = { style . values } > Compassion </ p >
61+ < p className = { style . values } > { t ( "values.compassion" ) } </ p >
8362 </ Col >
8463 < Col xs = { 12 } className = { style . blueBox } >
8564 < Image src = "/lightBulb.png" alt = "" className = { style . symbol } > </ Image >
86- < p className = { style . values } > Curiosity </ p >
65+ < p className = { style . values } > { t ( "values.curiosity" ) } </ p >
8766 </ Col >
8867 </ Row >
8968 </ Container >
0 commit comments