Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): Add default header for fiskistofa organization #15973

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ import { getBackgroundStyle } from '@island.is/web/utils/organization'

import { LatestNewsCardConnectedComponent } from '../LatestNewsCardConnectedComponent'
import { DigitalIcelandHeader } from './Themes/DigitalIcelandTheme'
import { FiskistofaHeader } from './Themes/FiskistofaTheme'
import {
FiskistofaDefaultHeader,
FiskistofaHeader,
} from './Themes/FiskistofaTheme'
import { FiskistofaFooter } from './Themes/FiskistofaTheme'
import {
FjarsyslaRikisinsFooter,
Expand Down Expand Up @@ -328,7 +331,13 @@ export const OrganizationHeader: React.FC<
/>
)
case 'fiskistofa':
return (
return n('usingDefaultHeader', false) ? (
<FiskistofaDefaultHeader
organizationPage={organizationPage}
logoAltText={logoAltText}
isSubpage={(isSubpage && n('smallerSubpageHeader', false)) ?? false}
/>
) : (
<FiskistofaHeader
organizationPage={organizationPage}
logoAltText={logoAltText}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { style } from '@vanilla-extract/css'

export const gridContainerWidth = style({
maxWidth: '1342px',
margin: '0 auto',
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import React from 'react'

import { ResponsiveSpace } from '@island.is/island-ui/core'
import { theme } from '@island.is/island-ui/theme'
import { DefaultHeader } from '@island.is/web/components'
import { OrganizationPage } from '@island.is/web/graphql/schema'
import { useLinkResolver } from '@island.is/web/hooks/useLinkResolver'
import { useWindowSize } from '@island.is/web/hooks/useViewport'

import * as styles from './FiskistofaDefaultHeader.css'

interface HeaderProps {
organizationPage: OrganizationPage
logoAltText: string
isSubpage: boolean
}

const FiskistofaDefaultHeader: React.FC<
React.PropsWithChildren<HeaderProps>
> = ({ organizationPage, logoAltText, isSubpage }) => {
const { linkResolver } = useLinkResolver()

const { width } = useWindowSize()

const themeProp = organizationPage.themeProperties

return (
<div
style={{
background:
(width > theme.breakpoints.lg && !isSubpage
mannipje marked this conversation as resolved.
Show resolved Hide resolved
? themeProp.backgroundColor
: 'no-repeat 52% 30% ,linear-gradient(180deg, #E6F2FB 21.56%, #90D9E3 239.74%)') ??
'',
}}
className={styles.gridContainerWidth}
>
<DefaultHeader
title={organizationPage.title}
titleColor="dark400"
imagePadding={themeProp.imagePadding ?? '0'}
fullWidth={themeProp.fullWidth ?? false}
imageIsFullHeight={themeProp.imageIsFullHeight ?? false}
imageObjectFit={
themeProp?.imageObjectFit === 'cover' ? 'cover' : 'contain'
}
logo={organizationPage.organization?.logo?.url}
logoHref={
linkResolver('organizationpage', [organizationPage.slug]).href
}
logoAltText={logoAltText}
titleSectionPaddingLeft={
organizationPage.themeProperties
.titleSectionPaddingLeft as ResponsiveSpace
}
isSubpage={isSubpage}
mobileBackground={
organizationPage.themeProperties.mobileBackgroundColor
}
/>
</div>
)
}

export default FiskistofaDefaultHeader
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import dynamic from 'next/dynamic'

import DefaultHeader from './FiskistofaDefaultHeader'
import Header from './FiskistofaHeader'

export const FiskistofaFooter = dynamic(() => import('./FiskistofaFooter'), {
ssr: false,
})

export const FiskistofaHeader = Header
export const FiskistofaDefaultHeader = DefaultHeader