add settings icon and modal

This commit is contained in:
La macchina desiderante 2024-05-11 14:55:52 +02:00
parent c282ae8854
commit 209285d3fa
6 changed files with 97 additions and 2 deletions

View File

@ -22,7 +22,8 @@
"Settings": { "Settings": {
"lang_title": "Please select language", "lang_title": "Please select language",
"lang_it": "Italian", "lang_it": "Italian",
"lang_en": "English" "lang_en": "English",
"settings_title": "Settings"
}, },
"Results": { "Results": {
"query": "Search results for: {{ query }}", "query": "Search results for: {{ query }}",

View File

@ -22,7 +22,8 @@
"Settings": { "Settings": {
"lang_title": "Seleziona la lingua", "lang_title": "Seleziona la lingua",
"lang_it": "Italiano", "lang_it": "Italiano",
"lang_en": "Inglese" "lang_en": "Inglese",
"settings_title": "Impostazioni"
}, },
"Results": { "Results": {
"query": "Risultati della ricerca per: {{ query }}", "query": "Risultati della ricerca per: {{ query }}",

View File

@ -0,0 +1,20 @@
@import 'spacing';
.container {
.header {
display: flex;
justify-content: space-between;
align-items: center;
.close {
cursor: pointer;
}
}
.content {
display: flex;
flex-direction: row;
}
}

View File

@ -0,0 +1,36 @@
'use client'
import React from 'react';
import { IoCloseCircleOutline } from "react-icons/io5";
import style from './Modal.module.scss'
interface Props {
handleClose(): void
labels: {
title: string
}
}
const LangSwitcher: React.FC<Props> = (props) => {
const { labels, handleClose } = props
return (
<dialog open>
<article className={style.container}>
<header className={style.header}>
<div className={style.title}>{labels.title}</div>
<div className={style.close} onClick={() => { handleClose() }}><IoCloseCircleOutline size={24} /></div>
</header>
<p className={style.content}>
SETTINGS
</p>
</article>
</dialog >
);
};
export default LangSwitcher;

View File

@ -0,0 +1,31 @@
'use client'
import React, { useState } from 'react';
import { IoSettingsOutline } from 'react-icons/io5';
import Icon from '../Icon';
import Modal from './Modal';
interface Props {
labels: any
}
const Settings: React.FC<Props> = (props) => {
const { labels } = props
const [showModal, setShowModal] = useState<boolean>(false)
return (
<>
<Icon handleClick={() => setShowModal(true)}>
{<IoSettingsOutline size={24} />}
</Icon>
{showModal && <Modal handleClose={() => setShowModal(false)} labels={labels} />}
</>
);
};
export default Settings;

View File

@ -8,6 +8,7 @@ import Theme from './Theme';
import Repo from './Repo'; import Repo from './Repo';
import Language from './Language'; import Language from './Language';
import { LangOption } from '@/meta/settings'; import { LangOption } from '@/meta/settings';
import Settings from './Settings';
const Menu: React.FC = () => { const Menu: React.FC = () => {
@ -23,11 +24,16 @@ const Menu: React.FC = () => {
langs: options langs: options
} }
const settingsLabels = {
title: t('settings_title'),
}
return ( return (
<div className={style.container}> <div className={style.container}>
<Repo /> <Repo />
<Language labels={languageLabels} /> <Language labels={languageLabels} />
<Theme /> <Theme />
<Settings labels={settingsLabels} />
</div> </div>
); );
}; };