Add footer

This commit is contained in:
Kacper Donat 2020-07-28 18:49:22 +02:00 committed by Gitea
parent 11bbad49fd
commit 1f127323a7
5 changed files with 44 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import { Trans, useTranslation } from "react-i18next";
import { Student } from "@/data"; import { Student } from "@/data";
import '@/styles/overrides.scss' import '@/styles/overrides.scss'
import '@/styles/header.scss' import '@/styles/header.scss'
import '@/styles/footer.scss'
import classNames from "classnames"; import classNames from "classnames";
import { EditionActions } from "@/state/actions/edition"; import { EditionActions } from "@/state/actions/edition";
import { sampleEdition } from "@/provider/dummy/edition"; import { sampleEdition } from "@/provider/dummy/edition";
@ -18,6 +19,7 @@ import { useDispatch } from "@/state/actions";
import { getLocale, Locale } from "@/state/reducer/settings"; import { getLocale, Locale } from "@/state/reducer/settings";
import i18n from "@/i18n"; import i18n from "@/i18n";
import moment from "moment"; import moment from "moment";
import { Container } from "@material-ui/core";
const UserMenu = (props: HTMLProps<HTMLUListElement>) => { const UserMenu = (props: HTMLProps<HTMLUListElement>) => {
const student = useSelector<AppState, Student>(state => state.student as Student); const student = useSelector<AppState, Student>(state => state.student as Student);
@ -72,7 +74,7 @@ const LanguageSwitcher = ({ className, ...props }: HTMLProps<HTMLUListElement>)
function App() { function App() {
const dispatch = useDispatch(); const dispatch = useDispatch();
const edition = useSelector<AppState, Edition | null>(state => state.edition); const edition = useSelector<AppState, Edition | null>(state => state.edition);
const { t } = useTranslation();
const locale = useSelector<AppState, Locale>(state => getLocale(state.settings)); const locale = useSelector<AppState, Locale>(state => getLocale(state.settings));
useEffect(() => { useEffect(() => {
@ -85,7 +87,7 @@ function App() {
i18n.changeLanguage(locale); i18n.changeLanguage(locale);
document.documentElement.lang = locale; document.documentElement.lang = locale;
moment.locale(locale) moment.locale(locale)
}) }, [ locale ])
const ready = useSelector(isReady); const ready = useSelector(isReady);
@ -108,7 +110,14 @@ function App() {
</nav> </nav>
</div> </div>
</header> </header>
<main id="content">
{ ready && <Switch>{ routes.map(({ name, content, ...route }) => <Route { ...route } key={ name }>{ content() }</Route>) }</Switch> } { ready && <Switch>{ routes.map(({ name, content, ...route }) => <Route { ...route } key={ name }>{ content() }</Route>) }</Switch> }
</main>
<footer className="footer">
<Container>
<div className="footer__copyright">{ t('copyright', { date: moment() }) }</div>
</Container>
</footer>
</>; </>;
} }

14
src/styles/footer.scss Normal file
View File

@ -0,0 +1,14 @@
@import "variables";
.footer {
background: $main-dark;
margin-top: 3rem;
color: #e4f1fe;
padding: 1rem 0;
display: flex;
font-size: 0.8rem;
}
.footer__copyright {
text-align: right;
}

View File

@ -14,6 +14,7 @@
html, body { html, body {
margin: 0; margin: 0;
padding: 0; padding: 0;
min-height: 100%;
font-family: "Roboto", "Helvetica", "Arial", sans-serif; font-family: "Roboto", "Helvetica", "Arial", sans-serif;
} }
@ -21,3 +22,16 @@ html, body {
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
#root {
display: flex;
flex-direction: column;
}
#content {
flex: 1 1 auto;
}
body, #root {
min-height: 100vh;
}

View File

@ -1,4 +1,6 @@
--- ---
copyright: ETI © {{ date, YYYY }}
login: login login: login
logout: logout logout: logout
logged-in-as: logged in as <1>{{ name }}</1> logged-in-as: logged in as <1>{{ name }}</1>

View File

@ -1,4 +1,6 @@
--- ---
copyright: Wydział ETI Politechniki Gdańskiej © {{ date, YYYY }}
login: zaloguj się login: zaloguj się
logout: wyloguj się logout: wyloguj się
logged-in-as: zalogowany jako <1>{{ name }}</1> logged-in-as: zalogowany jako <1>{{ name }}</1>