diff --git a/src/common/Layout/Footer.tsx b/src/common/Layout/Footer.tsx new file mode 100644 index 0000000..5912963 --- /dev/null +++ b/src/common/Layout/Footer.tsx @@ -0,0 +1,52 @@ +import { AUTHOR } from 'config/app'; + +import { makeStyles } from '@material-ui/core/styles'; +import { AppBar, Toolbar, Typography, Container } from '@material-ui/core'; +import Link from 'common/Link/Link'; + +const Footer = () => { + const classes = useStyles(); + return ( + + + + + zdamegzaminzawodowy.pl © {new Date().getFullYear()} + +
+ + Kontakt + +
+
+
+
+ ); +}; + +const useStyles = makeStyles(theme => { + return { + footer: { + top: 'auto', + bottom: 0, + }, + container: { + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + }, + links: { + '& > *:not(:last-child)': { + marginRight: theme.spacing(1), + }, + }, + }; +}); + +export default Footer; diff --git a/src/common/Layout/Layout.tsx b/src/common/Layout/Layout.tsx new file mode 100644 index 0000000..c7c82a9 --- /dev/null +++ b/src/common/Layout/Layout.tsx @@ -0,0 +1,35 @@ +import { makeStyles } from '@material-ui/core/styles'; +import { Toolbar } from '@material-ui/core'; +import TopBar from './TopBar'; +import Footer from './Footer'; + +export interface LayoutProps { + children?: React.ReactNode; +} + +const Layout = ({ children }: LayoutProps) => { + const classes = useStyles(); + return ( +
+ +
+ + {children} + +
+
+ ); +}; + +const useStyles = makeStyles(theme => ({ + main: { + padding: theme.spacing(3, 0), + minHeight: '100vh', + }, + container: { + position: 'relative', + }, +})); + +export default Layout; diff --git a/src/common/Layout/TopBar.tsx b/src/common/Layout/TopBar.tsx new file mode 100644 index 0000000..d24c545 --- /dev/null +++ b/src/common/Layout/TopBar.tsx @@ -0,0 +1,54 @@ +import { Route } from 'config/routing'; + +import { makeStyles } from '@material-ui/core/styles'; +import { AppBar, Toolbar, Typography, Container } from '@material-ui/core'; +import Link from 'common/Link/Link'; + +const TopBar = () => { + const classes = useStyles(); + return ( + + + +
+ + + zdamegzaminzawodowy.pl + zdamegzaminzawodowy.pl + + +
+
+
+
+ ); +}; + +const useStyles = makeStyles(theme => ({ + navbar: { + '& a': { + transition: 'all .2s', + cursor: 'pointer', + padding: theme.spacing(0.75, 1), + }, + }, + title: { + '& a': { + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + color: 'inherit', + '& span': { + [theme.breakpoints.down('xs')]: { + display: 'none', + }, + }, + }, + '& img': { + width: theme.spacing(6), + marginRight: theme.spacing(1), + }, + }, +})); + +export default TopBar; diff --git a/src/common/Link/Link.tsx b/src/common/Link/Link.tsx new file mode 100644 index 0000000..1f90ba2 --- /dev/null +++ b/src/common/Link/Link.tsx @@ -0,0 +1,49 @@ +import NextLink, { LinkProps as NextLinkProps } from 'next/link'; +import { Link as MUILink, LinkProps as MUILinkProps } from '@material-ui/core'; + +export type LinkProps = Omit & + Pick< + NextLinkProps, + 'href' | 'as' | 'replace' | 'scroll' | 'prefetch' | 'shallow' | 'locale' + >; + +const Link = ({ + href, + as, + replace, + scroll, + prefetch, + shallow, + locale, + children, + ...rest +}: LinkProps) => { + if ( + typeof href === 'string' && + (href.match(/^([a-z0-9]*:|.{0})\/\/.*$/gim) || + href.substr(0, 7) === 'mailto:') + ) { + return ( + + {children} + + ); + } + + return ( + + {children} + + ); +}; + +export default Link; diff --git a/src/config/app.ts b/src/config/app.ts new file mode 100644 index 0000000..5aeaba1 --- /dev/null +++ b/src/config/app.ts @@ -0,0 +1,4 @@ +export const AUTHOR = { + FULL_NAME: 'Dawid Wysokiński', + CONTACT: 'https://dwysokinski.me/#contact', +}; diff --git a/src/config/routing.ts b/src/config/routing.ts new file mode 100644 index 0000000..043c170 --- /dev/null +++ b/src/config/routing.ts @@ -0,0 +1,3 @@ +export enum Route { + IndexPage = '/', +} diff --git a/src/features/IndexPage/IndexPage.tsx b/src/features/IndexPage/IndexPage.tsx index bbfcdfe..f2cbd4d 100644 --- a/src/features/IndexPage/IndexPage.tsx +++ b/src/features/IndexPage/IndexPage.tsx @@ -1,5 +1,7 @@ +import Layout from 'common/Layout/Layout'; + const IndexPage = () => { - return
hello?
; + return hello?; }; export default IndexPage;