-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from daveymason/homepage
Homepage
- Loading branch information
Showing
12 changed files
with
407 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, { useState, useContext } from "react"; | ||
import { ButtonGroup, Radio } from "@mui/material"; | ||
|
||
//check if there are any props being passed to the component | ||
//if there are, use them, if not, use the default value | ||
|
||
function LanguageSwitcher() { | ||
const [language, setLanguage] = useState("english"); | ||
|
||
const handleLanguageChange = (event) => { | ||
setLanguage(event.target.value); | ||
alert(event.target.value | ||
? "Language changed to " + event.target.value | ||
: "Language not changed" | ||
); | ||
}; | ||
|
||
return ( | ||
|
||
<ButtonGroup size="small" aria-label="language" color="primary"> | ||
<Radio | ||
checked={language === "english"} | ||
onChange={handleLanguageChange} | ||
value="english" | ||
icon={ | ||
<img | ||
src="/englishIcon.png" | ||
alt="English" | ||
style={{ height: "1.5rem" }} | ||
/> | ||
} | ||
checkedIcon={ | ||
<img | ||
src="/englishIcon.png" | ||
alt="EnglishChecked" | ||
style={{ height: "2.5rem" }} | ||
/> | ||
} | ||
/> | ||
<Radio | ||
checked={language === "turkish"} | ||
onChange={handleLanguageChange} | ||
value="turkish" | ||
icon={ | ||
<img src="/turkeyIcon.png" alt="Turkish" style={{ height: "1.5rem" }} /> | ||
} | ||
checkedIcon={ | ||
<img | ||
src="/turkeyIcon.png" | ||
alt="TurkishChecked" | ||
style={{ height: "2.5rem" }} | ||
/> | ||
} | ||
/> | ||
</ButtonGroup> | ||
); | ||
} | ||
|
||
export default LanguageSwitcher; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.button-container { | ||
display: flex; | ||
justify-content: space-around; | ||
} | ||
|
||
.button { | ||
display: flex; | ||
align-items: center; | ||
margin: 10px; | ||
padding: 10px 20px; | ||
box-shadow: 2px 2px 4px #282828; | ||
border-radius: 10px; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Button } from '@mui/material'; | ||
|
||
const GroupButton = ({ buttons }) => { | ||
return ( | ||
<div className="button-container"> | ||
{buttons.map((button) => ( | ||
<Button | ||
key={button.label} | ||
variant="contained" | ||
color={button.color} | ||
className="button" | ||
style={button.style} | ||
> | ||
{button.icon} | ||
</Button> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default GroupButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React, { createContext, useState } from 'react'; | ||
|
||
export const LanguageContext = createContext(); | ||
|
||
function LanguageProvider({ children }) { | ||
const [language, setLanguage] = useState('english'); | ||
const value = { | ||
language, | ||
setLanguage | ||
}; | ||
return ( | ||
<LanguageContext.Provider value={value}> | ||
{children} | ||
</LanguageContext.Provider> | ||
); | ||
} | ||
|
||
export default LanguageProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React, { useState } from 'react'; | ||
import { LanguageContext } from 'context/LanguageContext'; | ||
|
||
function LanguageProvider({ children }) { | ||
const [language, setLanguage] = useState('english'); | ||
|
||
return ( | ||
<LanguageContext.Provider value={{ language, setLanguage }}> | ||
{children} | ||
</LanguageContext.Provider> | ||
); | ||
} | ||
|
||
export default LanguageProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
import '@styles/globals.css' | ||
import React from 'react'; | ||
import Head from 'next/head'; | ||
import '@styles/globals.css'; | ||
|
||
import LanguageProvider from 'context/LanguageContext'; | ||
|
||
function Application({ Component, pageProps }) { | ||
return <Component {...pageProps} /> | ||
return ( | ||
<LanguageProvider> | ||
<Component {...pageProps} /> | ||
</LanguageProvider> | ||
); | ||
} | ||
|
||
export default Application | ||
export default Application; |
Oops, something went wrong.