Skip to content

Commit

Permalink
feat(eb): Add default header for sjukratryggingar organization (#16012)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
mannipje and kodiakhq[bot] authored Sep 14, 2024
1 parent 150ab3a commit eb982d4
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ import { RikissaksoknariHeader } from './Themes/RikissaksoknariTheme'
import { SAkFooter, SAkHeader } from './Themes/SAkTheme'
import { ShhFooter, ShhHeader } from './Themes/SHHTheme'
import {
SjukratryggingarDefaultHeader,
SjukratryggingarFooter,
SjukratryggingarHeader,
} from './Themes/SjukratryggingarTheme'
Expand Down Expand Up @@ -284,7 +285,13 @@ export const OrganizationHeader: React.FC<
/>
)
case 'sjukratryggingar':
return (
return n('usingDefaultHeader', false) ? (
<SjukratryggingarDefaultHeader
organizationPage={organizationPage}
logoAltText={logoAltText}
isSubpage={(isSubpage && n('smallerSubpageHeader', false)) ?? false}
/>
) : (
<SjukratryggingarHeader
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,68 @@
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 './SjukratryggingarDefaultHeader.css'

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

const SjukratryggingarDefaultHeader: 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.sm
? '#40c5e5'
: (width > theme.breakpoints.lg && !isSubpage
? themeProp.backgroundColor
: `linear-gradient(184.95deg, #40c5e5 8.38%, rgba(64, 197, 227, 0.1) 39.64%, rgba(244, 247, 247, 0) 49.64%),
linear-gradient(273.41deg, #f4f7f7 -9.24%, #40c5e5 66.78%, #a4def1 105.51%)`) ??
'',
}}
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 SjukratryggingarDefaultHeader
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import dynamic from 'next/dynamic'

import DefaultHeader from './SjukratryggingarDefaultHeader'
import Header from './SjukratryggingarHeader'

export const SjukratryggingarDefaultHeader = DefaultHeader
export const SjukratryggingarHeader = Header

export const SjukratryggingarFooter = dynamic(
Expand Down

0 comments on commit eb982d4

Please sign in to comment.