Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • andretol/greg
1 result
Show changes
Showing
with 244 additions and 46 deletions
import React from 'react'
import { render, waitFor, screen } from '@testing-library/react'
import Link from './index'
describe('Tests for Link component', () => {
test('External link prefixes route link with //', async () => {
render(<Link external to='example.org' />)
await waitFor(() => screen.getByRole('link'))
expect(screen.getByRole('link')).toHaveAttribute('href', '//example.org')
})
})
\ No newline at end of file
import React from 'react'
import { appTheme } from 'appConfig'
import UiOLogoBar from './UiO'
import UiBLogoBar from './UiB'
function LogoBar() {
switch (appTheme) {
case 'uio':
return <UiOLogoBar />
case 'uib':
return <UiBLogoBar />
default:
return <UiOLogoBar />
}
}
export default LogoBar
\ No newline at end of file
import React from 'react'
import styled from 'styled-components/macro'
const LogoBarWrapper = styled.div`
background-color: ${(props) => props.theme.colors.secondary});
`
const LogoBar = styled.div`
margin: 0 auto;
max-width: ${({ theme }) => theme.appMaxWidth});
padding: 0 ${({ theme }) => theme.horizontalMdPadding});
`
function UiBLogoBar() {
return (
<LogoBarWrapper>
<LogoBar>
Insert UiB logo here
</LogoBar>
</LogoBarWrapper>
)
}
export default UiBLogoBar
import React from 'react'
import styled from 'styled-components/macro'
import { useTranslation } from 'react-i18next'
const LogoBarWrapper = styled.div`
display: flex;
justify-content: center;
background-color: ${({ theme }) => theme.page.headerBackgroundColor};
`
type Language = {
language: string
}
const Logo = styled.div<Language>`
background: ${props => props.language === 'en' ? 'url("/uio/uio-app-logo-en.png") left center no-repeat' : 'url("/uio/uio-app-logo-nb.png") left center no-repeat'};
min-width: 20rem;
height: 2rem;
`
function UiOLogoBar() {
const { i18n } = useTranslation(['common', 'footer'])
return (
<LogoBarWrapper>
<Logo language={i18n.language} />
</LogoBarWrapper>
)
}
export default UiOLogoBar
import Page from 'components/page/page' import Page from 'components/page/page'
export { Page } export default Page
...@@ -8,8 +8,8 @@ import 'i18n' ...@@ -8,8 +8,8 @@ import 'i18n'
import getTheme from 'themes' import getTheme from 'themes'
import GlobalStyle from 'globalStyles' import GlobalStyle from 'globalStyles'
import App from 'routes' import App from 'routes'
import reportWebVitals from './reportWebVitals'
import Loading from 'components/loading' import Loading from 'components/loading'
import reportWebVitals from './reportWebVitals'
function appRoot() { function appRoot() {
return ( return (
......
import React from 'react' import React from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { useTranslation } from 'react-i18next'
import {
appStagingWarning,
appTechnicalSupportLink,
reponsibleOrganization, responsibleOrganizationLink,
} from '../../appConfig'
import Link from '../../components/link'
// Placeholder footer component
const StyledFooter = styled.footer` const FooterWrapper = styled.footer`
background: ${({ theme }) => theme.footer.backgroundColor}; background: ${({ theme }) => theme.footer.backgroundColor};
padding: 4rem 0; height: fit-content;
padding: 0rem ${({ theme }) => theme.horizontalPadding};
margin-top: auto; margin-top: auto;
` `
const FooterWrapper = styled.div` const FooterSection = styled.section`
background: ${({ theme }) => theme.footer.backgroundColor}; header {
color: white; margin-bottom: 0.5rem;
height: fit-content; font-size: 1.5rem;
max-width: ${({ theme }) => theme.appMaxWidth}; }
margin: 0 auto;
padding: 0rem ${({ theme }) => theme.horizontalPadding}; padding-left: 1rem;
`
const FooterSectionContent = styled.div`
font-size: 1rem;
padding-left: 0.3rem;
`
const ContentContainer = styled.div`
width: fit-content;
color: ${({ theme }) => theme.footerTextColor};
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
margin: auto;
padding-top: 1rem;
padding-right: 1rem;
padding-bottom: 1rem;
` `
export default function Footer() { const Footer: React.FunctionComponent = () => {
const { t } = useTranslation(['common', 'footer'])
return ( return (
<StyledFooter> <>
<FooterWrapper>Footer 123</FooterWrapper> <FooterWrapper>
</StyledFooter> <ContentContainer>
<FooterSection>
<header>{t('footer:contactSectionHeader')}</header>
<FooterSectionContent>
<Link
external
to={appTechnicalSupportLink}
inheritColor
underline
>
{t('footer:contactHelp')}
</Link>
</FooterSectionContent>
</FooterSection>
<FooterSection>
<header>{t('footer:responsibleOrganizationHeader')}</header>
<FooterSectionContent>
<Link
external
to={responsibleOrganizationLink}
inheritColor
underline
>
{reponsibleOrganization}
</Link>
</FooterSectionContent>
</FooterSection>
</ContentContainer>
</FooterWrapper>
{appStagingWarning && (
<div className='alert'>
{t('staging')}
</div>
)}
</>
) )
} }
export default Footer
import React from 'react' import React from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { useTranslation } from 'react-i18next'
import LogoBar from '../../components/logobars/LogoBar'
import LanguageSelector from '../../components/languageselector'
// Placeholder header component!
const MainWrapper = styled.div` const MainWrapper = styled.div`
background-color: green; color: ${({ theme }) => theme.page.headerColor};
background-color: ${({ theme }) => theme.page.headerBackgroundColor};
` `
const Main = styled.div` const Main = styled.div`
display: flex;
justify-content: space-between;
margin: 0 auto; margin: 0 auto;
max-width: ${({ theme }) => theme.maxWidth}; max-width: ${props => props.theme.appMaxWidth};
height: ${({ theme }) => theme.header.height}; padding: ${props => `0.5rem ${props.theme.horizontalPadding} 1rem ${props.theme.horizontalPadding}`};
padding: 2.5rem ${({ theme }) => theme.horizontalPadding} 3rem `
${({ theme }) => theme.horizontalPadding};
const Menu = styled.ul`
list-style-type: none;
`
const MenuItem = styled.div`
font-size: 1rem;
display: inline;
` `
const MainRow = styled.div` const TitleBox = styled.div`
display: flex; display: flex;
justify-content: space-between; flex-direction: column;
padding-left: 3rem;
` `
const PageTitle = styled.div` const ShortTitle = styled.div`
color: blue; font-size: 2rem;
` `
const H2 = styled.h2`
font-size: 2.8rem; const LongTitle = styled.div`
line-height: 4.5rem; font-size: 1rem;
` `
export default function Header() { function Header() {
const { t } = useTranslation('common')
return ( return (
<header> <header>
<LogoBar />
<MainWrapper> <MainWrapper>
<Main> <Main>
<MainRow> <TitleBox>
<PageTitle> <ShortTitle>{t('header.applicationTitleShort')}</ShortTitle>
<H2>Greg!</H2> <LongTitle>{t('header.applicationTitleLong')}</LongTitle>
</PageTitle> </TitleBox>
</MainRow> <Menu>
<MenuItem>
<LanguageSelector/>
</MenuItem>
</Menu>
</Main> </Main>
</MainWrapper> </MainWrapper>
</header> </header>
) )
} }
export default Header
import React from 'react' import React from 'react'
import { Page } from 'components/page' import Page from 'components/page'
export default function NotFound() { export default function NotFound() {
return ( return (
......
import React, { useState } from 'react' import React, { useState } from 'react'
import { Page } from 'components/page' import Page from 'components/page'
import { appTimezone, appVersion, appTheme } from 'appConfig' import { appTimezone, appVersion, appTheme } from 'appConfig'
export default function FrontPage() { export default function FrontPage() {
...@@ -18,9 +18,9 @@ export default function FrontPage() { ...@@ -18,9 +18,9 @@ export default function FrontPage() {
setApiHealth(result) setApiHealth(result)
} }
}) })
// eslint-disable-next-line @typescript-eslint/no-unused-vars
.catch((error) => { .catch((error) => {
setApiHealth('error') setApiHealth('error')
console.log(error)
}) })
} }
return ( return (
......
import React from 'react' import React from 'react'
import { Page } from 'components/page' import Page from 'components/page'
export default function Register() { export default function Register() {
return ( return (
......
import React from 'react' import React from 'react'
import { Page } from 'components/page' import Page from 'components/page'
function FrontPage() { function FrontPage() {
return ( return (
......
import React from 'react' import React from 'react'
import { useParams } from 'react-router-dom' import { useParams } from 'react-router-dom'
import {Page} from 'components/page' import Page from 'components/page'
type GuestInfoParams = { type GuestInfoParams = {
id: string id: string
......
const { createProxyMiddleware } = require('http-proxy-middleware') const { createProxyMiddleware } = require('http-proxy-middleware')
module.exports = function (app) { module.exports = (app) => {
app.use( app.use(
'/api', '/api',
createProxyMiddleware({ createProxyMiddleware({
......
...@@ -7,6 +7,7 @@ declare module 'styled-components' { ...@@ -7,6 +7,7 @@ declare module 'styled-components' {
colors: { colors: {
main: string main: string
secondary: string secondary: string
dropDownMenuBackground: string
} }
footer: { footer: {
backgroundColor: string backgroundColor: string
...@@ -17,9 +18,14 @@ declare module 'styled-components' { ...@@ -17,9 +18,14 @@ declare module 'styled-components' {
horizontalPadding: string horizontalPadding: string
linkExternalColor: string linkExternalColor: string
linkInternalColor: string linkInternalColor: string
footerBackgroundColor: string
footerTextColor: string
footerJustifyContent: string
horizontalMdPadding: string
maxWidth: string maxWidth: string
page: { page: {
headerColor: string headerColor: string
headerBackgroundColor: string
horizontalPadding: string horizontalPadding: string
} }
} }
......
...@@ -5,9 +5,7 @@ import { ThemeProvider } from 'styled-components/macro' ...@@ -5,9 +5,7 @@ import { ThemeProvider } from 'styled-components/macro'
import mainTheme from 'themes/main' import mainTheme from 'themes/main'
// Providers used in test rendering // Providers used in test rendering
const AllTheProviders = ({ children }: any) => { const AllTheProviders = ({ children }: any) => <ThemeProvider theme={mainTheme}> {children} </ThemeProvider>
return <ThemeProvider theme={mainTheme}> {children} </ThemeProvider>
}
// Custom testing-library/react renderer using our providers. // Custom testing-library/react renderer using our providers.
const customRender = (ui: React.ReactElement, options?: any) => const customRender = (ui: React.ReactElement, options?: any) =>
......
export module Color {
export const white = '#FFFFFF'
export const hotPink = '#FF69B4'
export const blueish = '#2771bb'
export const lightOliveGreen = '#91BD60'
export const black = '#000000'
export const darkGray = '#2D2D2E'
export const lighterBlack = '#282c34'
}
...@@ -6,6 +6,7 @@ const mainTheme: DefaultTheme = { ...@@ -6,6 +6,7 @@ const mainTheme: DefaultTheme = {
colors: { colors: {
main: 'hotPink', main: 'hotPink',
secondary: 'white', secondary: 'white',
dropDownMenuBackground: 'grey'
}, },
footer: { footer: {
backgroundColor: 'black', backgroundColor: 'black',
...@@ -17,8 +18,13 @@ const mainTheme: DefaultTheme = { ...@@ -17,8 +18,13 @@ const mainTheme: DefaultTheme = {
linkInternalColor: 'white', linkInternalColor: 'white',
linkExternalColor: 'blueish', linkExternalColor: 'blueish',
maxWidth: '110rem', maxWidth: '110rem',
footerBackgroundColor: 'green',
footerTextColor: 'white',
footerJustifyContent: 'flex-end',
horizontalMdPadding: '6.5rem',
page: { page: {
headerColor: 'grey', headerColor: 'white',
headerBackgroundColor: 'black',
horizontalPadding: '0rem', horizontalPadding: '0rem',
}, },
} }
......
...@@ -2,6 +2,7 @@ const uibTheme = { ...@@ -2,6 +2,7 @@ const uibTheme = {
colors: { colors: {
main: 'hotPink', main: 'hotPink',
secondary: 'black', secondary: 'black',
dropDownMenuBackground: 'grey'
}, },
} }
......
...@@ -2,6 +2,7 @@ const uioTheme = { ...@@ -2,6 +2,7 @@ const uioTheme = {
colors: { colors: {
main: 'hotPink', main: 'hotPink',
secondary: 'white', secondary: 'white',
dropDownMenuBackground: 'grey'
}, },
} }
......