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): Grant - Mobile view and sidemenu refactor #17214

Merged
merged 12 commits into from
Dec 20, 2024
7 changes: 7 additions & 0 deletions apps/web/screens/Grants/Grant/Grant.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { globalStyle, style } from '@vanilla-extract/css'

export const noUnderline = style({})

globalStyle(`${noUnderline} span`, {
boxShadow: 'none',
})
68 changes: 54 additions & 14 deletions apps/web/screens/Grants/Grant/Grant.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useMemo } from 'react'
import { useIntl } from 'react-intl'
import NextLink from 'next/link'
import { useRouter } from 'next/router'
Expand All @@ -8,11 +9,12 @@ import {
Box,
Breadcrumbs,
Divider,
Hidden,
Stack,
Text,
} from '@island.is/island-ui/core'
import { Locale } from '@island.is/shared/types'
import { GrantWrapper } from '@island.is/web/components'
import { GrantWrapper, InstitutionPanel } from '@island.is/web/components'
import {
ContentLanguage,
CustomPageUniqueIdentifier,
Expand All @@ -32,7 +34,10 @@ import {
import SidebarLayout from '../../Layouts/SidebarLayout'
import { GET_GRANT_QUERY } from '../../queries'
import { m } from '../messages'
import { GrantSidebar } from './GrantSidebar'
import { generateStatusTag, parseStatus } from '../utils'
import DetailPanel from './GrantSidebar/DetailPanel'
import ExtraPanel from './GrantSidebar/ExtraPanel'
import { GrantSidebar } from './GrantSidebar/GrantSidebar'

const GrantSinglePage: CustomScreen<GrantSingleProps> = ({ grant, locale }) => {
const { formatMessage } = useIntl()
Expand Down Expand Up @@ -67,6 +72,11 @@ const GrantSinglePage: CustomScreen<GrantSingleProps> = ({ grant, locale }) => {
},
]

const status = useMemo(
() => (grant ? parseStatus(grant, formatMessage, locale) : null),
[grant, formatMessage, locale],
)

if (!grant) {
return null
}
Expand Down Expand Up @@ -100,21 +110,37 @@ const GrantSinglePage: CustomScreen<GrantSingleProps> = ({ grant, locale }) => {
</Text>
<Text variant="default">{grant.description}</Text>
</Box>
<ActionCard
heading={grant.name}
backgroundColor="blue"
cta={{
disabled: !grant.applicationUrl?.slug,
label:
grant.applicationButtonLabel ?? formatMessage(m.single.apply),
onClick: () => router.push(grant.applicationUrl?.slug ?? ''),
icon: 'open',
iconType: 'outline',
}}
/>
<Hidden above="sm">
<DetailPanel grant={grant} locale={locale} button />
</Hidden>
<Hidden below="md">
<ActionCard
heading={grant.name}
text={
status
? generateStatusTag(status.applicationStatus, formatMessage)
?.label +
(status.deadlineStatus ? ' / ' + status.deadlineStatus : '')
: ''
}
backgroundColor="blue"
cta={{
disabled:
status?.applicationStatus === 'closed' ||
status?.applicationStatus === 'unknown',
size: 'small',
label:
grant.applicationButtonLabel ?? formatMessage(m.single.apply),
onClick: () => router.push(grant.applicationUrl?.slug ?? ''),
icon: 'open',
iconType: 'outline',
}}
/>
</Hidden>
{grant.specialEmphasis?.length ? (
<>
<Box className="rs_read">
{status?.note && <Text fontWeight="medium">{status.note}</Text>}
{webRichText(
grant.specialEmphasis as SliceType[],
undefined,
Expand Down Expand Up @@ -164,6 +190,20 @@ const GrantSinglePage: CustomScreen<GrantSingleProps> = ({ grant, locale }) => {
)}
</Box>
) : undefined}
<Hidden above="md">
<ExtraPanel grant={grant} />
</Hidden>
<Hidden above="md">
<InstitutionPanel
institutionTitle={formatMessage(m.single.provider)}
institution={
grant.fund?.parentOrganization.title ??
formatMessage(m.single.unknownInstitution)
}
img={grant.fund?.parentOrganization.logo?.url}
locale={locale}
/>
</Hidden>
</Stack>
</SidebarLayout>
</GrantWrapper>
Expand Down
185 changes: 0 additions & 185 deletions apps/web/screens/Grants/Grant/GrantSidebar.tsx

This file was deleted.

Loading
Loading