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

Stories og types Themed Page Header #2029

Merged
merged 65 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
82c0de3
bruk hook for language
bdahle Sep 26, 2024
9beccc3
FormIntermediate kun send brukte props til ThemedPageHeader (diverse …
bdahle Sep 26, 2024
4e895ef
uncomment data
bdahle Sep 26, 2024
58d37be
Refactor FormIntermediateStepPage to destructure props for improved r…
bdahle Sep 26, 2024
e75570a
basic story ThemedPageHeader
bdahle Sep 26, 2024
a17256e
Update ThemedPageHeader props to use ContentProps and refine data str…
bdahle Sep 26, 2024
8150bcd
egen props for getContentTagline
bdahle Sep 26, 2024
398556d
reverser hook for å hente language
bdahle Sep 26, 2024
f02d470
uncomment subtitle og modified
bdahle Sep 26, 2024
d919121
reverser rekkefølge type
bdahle Sep 26, 2024
0ab58d2
Revert "reverser rekkefølge type"
bdahle Sep 26, 2024
f1b56f8
reverser rekkefølge props
bdahle Sep 26, 2024
ed168a5
refactor: destructure data props in FormIntermediateStepPage component
bdahle Sep 26, 2024
fcc7a9c
refactor: remove unused imports in ThemedPageHeader component
bdahle Sep 26, 2024
1efed42
uncomment ThemedPageHeader in OfficeEditorialPage and OverviewPage co…
bdahle Oct 1, 2024
0f3289a
fjern Todo foreløpig
bdahle Oct 1, 2024
4b2d0d9
flytt ThemedPageHeader ut av wrapper-mappe i Storybook
bdahle Oct 1, 2024
9c09c8a
feat: add WithTimeStamp story to ThemedPageHeader component
bdahle Oct 1, 2024
800f352
feat: add OverviewPage story to ThemedPageHeader component
bdahle Oct 1, 2024
47943eb
fix: update display name in ThemedPageHeader story
bdahle Oct 1, 2024
28bc2ac
refactor: move CurrentTopicPageProps type definition to CurrentTopicP…
bdahle Oct 1, 2024
e532c19
refactor: update getPublishedAndModifiedString function to accept pro…
bdahle Oct 1, 2024
7f777dd
feat: add TagLine component story to Storybook
bdahle Oct 1, 2024
200f0cc
feat: add DateLine component story to Storybook
bdahle Oct 1, 2024
9badb8d
feat: add FeaturedHeader component story to Storybook and update prop…
bdahle Oct 1, 2024
e4b859a
flytt DateLine og Tagline til egne mapper
bdahle Oct 1, 2024
9559ad4
fjern wrappermappe i storybook
bdahle Oct 1, 2024
1f90f0b
flytt PagePropsForPageHeader til eneste sted den fortsatt brukes
bdahle Oct 2, 2024
7419802
refactor: update PagePropsForPageHeader type to use Pick and include …
bdahle Oct 2, 2024
989cb9f
refactor: update pageProps type in GeneralPageHeader and SingleColPag…
bdahle Oct 2, 2024
a478d48
refactor: destructure data properties in SingleColPage for improved r…
bdahle Oct 2, 2024
ad12b06
feat: add story for GeneralPageHeader component in Storybook
bdahle Oct 2, 2024
f6929bb
fix: update ContentType in GeneralPageHeader story from SituationPage…
bdahle Oct 2, 2024
1c083c9
refactor: remove commented-out code in GeneralPageHeader for cleaner …
bdahle Oct 2, 2024
0375bfc
refactor: simplify pageProps type definition in GeneralPageHeader for…
bdahle Oct 2, 2024
25b9b93
refactor: destructure pageProps data in GeneralPageHeader for improve…
bdahle Oct 2, 2024
09956f7
feat: add SituationPage story to GeneralPageHeader in Storybook
bdahle Oct 2, 2024
e3e6509
fix: add comment explaining negative margin hack in SituationPage story
bdahle Oct 2, 2024
3abc192
fix: update comment to clarify negative margin hack in SituationPage …
bdahle Oct 2, 2024
1b10088
feat: add Employer, Provider, and CustomCategory stories to GeneralPa…
bdahle Oct 2, 2024
5e3e7af
feat: add HideIngress story to GeneralPageHeader in Storybook
bdahle Oct 2, 2024
537f873
fjern wrapper-mappe storybook
bdahle Oct 2, 2024
638ef11
lengre ingress i story
bdahle Oct 2, 2024
188f07c
refactor: remove TODO comment in FeaturedHeader component
bdahle Oct 2, 2024
6e729ed
basic story ReadMorePart
bdahle Oct 3, 2024
3fb2eb4
Update ReadMorePart story with default args for type and descriptor
bdahle Oct 3, 2024
49ae5aa
Update Default story for ReadMorePart with detailed processedHtml con…
bdahle Oct 3, 2024
08de1f1
Remove centered layout parameter from Storybook preview configuration
bdahle Oct 3, 2024
d7af6ee
legg til to ulike viewport-størrelser i chromatic
bdahle Oct 3, 2024
c5dd129
open state ReadMore story
bdahle Oct 3, 2024
a2c48ba
Refactor viewport settings in Storybook configuration
bdahle Oct 3, 2024
1e43072
Add Storybook stories for ChatOption component
bdahle Oct 3, 2024
2f9013c
Add Storybook stories for CallOption and WriteOption components; upda…
bdahle Oct 3, 2024
302e06c
Add Storybook stories for OpeningInfo component
bdahle Oct 3, 2024
9bd59a9
fjern wrapper-mappe storybook
bdahle Oct 3, 2024
0cec7d2
Add Storybook stories for DefaultOption component
bdahle Oct 3, 2024
608ea9c
egen mappe CallOption
bdahle Oct 3, 2024
82abdc3
egen mappe ChatOption
bdahle Oct 3, 2024
c08c92d
egen mappe WriteOption
bdahle Oct 3, 2024
283b708
Add background parameters to DefaultOption stories
bdahle Oct 3, 2024
011c9b5
fjern wrapper-mappe storybook
bdahle Oct 4, 2024
922daae
Merge pull request #2032 from navikt/featured-header
bdahle Oct 9, 2024
1911fd5
Merge pull request #2033 from navikt/general-page-header-story
bdahle Oct 9, 2024
c38603f
Merge pull request #2036 from navikt/contact-option-stories
bdahle Oct 9, 2024
703ce2c
Merge pull request #2035 from navikt/part-stories
bdahle Oct 9, 2024
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
8 changes: 8 additions & 0 deletions .storybook/modes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const allModes = {
small: {
viewport: 'small',
},
large: {
viewport: 'large',
},
};
14 changes: 13 additions & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import type { Preview } from '@storybook/react';
import { allModes } from '../.storybook/modes';
import '../src/global.scss';

const preview: Preview = {
parameters: {
layout: 'centered',
viewport: {
viewports: {
small: { name: 'small', styles: { width: '390px', height: '100%' } },
large: { name: 'large', styles: { width: '820px', height: '100%' } },
},
},
chromatic: {
modes: {
small: allModes['small'],
large: allModes['large'],
},
},
},
tags: ['autodocs'],
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Meta, StoryObj } from '@storybook/react';

import { CallOption } from './CallOption';

const meta = {
component: CallOption,
parameters: {
backgrounds: {
values: [{ name: 'ContactBackground', value: '#f2f3f5' }],
default: 'ContactBackground',
},
},
} satisfies Meta<typeof CallOption>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {};

export const WithAlert: Story = { args: { alertText: 'Alert!' } };
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { LenkeBase } from 'components/_common/lenke/LenkeBase';
import { AnalyticsEvents } from 'utils/amplitude';
import { useLayoutConfig } from 'components/layouts/useLayoutConfig';
import { ParsedHtml } from 'components/_common/parsed-html/ParsedHtml';
import { OpeningInfo } from 'components/_common/contact-option/opening-info/OpeningInfo';
import { OpeningInfo } from 'components/_common/contact-option/openingInfo/OpeningInfo';
import { Audience, getAudience } from 'types/component-props/_mixins';
import { ProcessedHtmlProps } from 'types/processed-html-props';
import { usePageContentProps } from 'store/pageContext';
import { TelephoneData } from 'components/parts/contact-option/ContactOptionPart';
import { Icon } from 'components/_common/contact-option/icon/Icon';

import sharedStyle from './ContactOption.module.scss';
import alertStyle from './Alert.module.scss';
import sharedStyle from 'components/_common/contact-option/ContactOption.module.scss';
import alertStyle from 'components/_common/contact-option/Alert.module.scss';
import style from './CallOption.module.scss';

const contactURLs: Record<Audience, Record<'no' | 'en', string>> = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Meta, StoryObj } from '@storybook/react';

import { ChatOption } from './ChatOption';

const meta = {
component: ChatOption,
parameters: {
backgrounds: {
values: [{ name: 'ContactBackground', value: '#f2f3f5' }],
default: 'ContactBackground',
},
},
} satisfies Meta<typeof ChatOption>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = { args: {} };

export const WithAlert: Story = { args: { alertText: 'Alert!' } };
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { ParsedHtml } from 'components/_common/parsed-html/ParsedHtml';
import TextWithIndicator from 'components/_common/textWithIndicator/TextWithIndicator';
import { ChatData } from 'components/parts/contact-option/ContactOptionPart';
import { Icon } from 'components/_common/contact-option/icon/Icon';
import { OpeningInfo } from './opening-info/OpeningInfo';
import { OpeningInfo } from 'components/_common/contact-option/openingInfo/OpeningInfo';

import sharedStyle from './ContactOption.module.scss';
import alertStyle from './Alert.module.scss';
import sharedStyle from 'components/_common/contact-option/ContactOption.module.scss';
import alertStyle from 'components/_common/contact-option/Alert.module.scss';

export const ChatOption = (props: ChatData) => {
const { ingress, title, alertText, regularOpeningHours, specialOpeningHours } = props;
Expand Down
21 changes: 21 additions & 0 deletions src/components/_common/contact-option/DefaultOption.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Meta, StoryObj } from '@storybook/react';

import { DefaultOption } from './DefaultOption';

const meta = {
component: DefaultOption,
parameters: {
backgrounds: {
values: [{ name: 'ContactBackground', value: '#f2f3f5' }],
default: 'ContactBackground',
},
},
} satisfies Meta<typeof DefaultOption>;

export default meta;

type Story = StoryObj<typeof meta>;

export const AidCentral: Story = { args: { channel: 'aidcentral' } };

export const NavOffice: Story = { args: { channel: 'navoffice' } };
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Meta, StoryObj } from '@storybook/react';

import { WriteOption } from './WriteOption';

const meta = {
component: WriteOption,
parameters: {
backgrounds: {
values: [{ name: 'ContactBackground', value: '#f2f3f5' }],
default: 'ContactBackground',
},
},
} satisfies Meta<typeof WriteOption>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {};

export const WithAlert: Story = { args: { alertText: 'Alert!' } };
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import Config from 'config';
import { WriteData } from 'components/parts/contact-option/ContactOptionPart';
import { Icon } from 'components/_common/contact-option/icon/Icon';

import sharedStyle from './ContactOption.module.scss';
import alertStyle from './Alert.module.scss';
import sharedStyle from 'components/_common/contact-option/ContactOption.module.scss';
import alertStyle from 'components/_common/contact-option/Alert.module.scss';

type Props = WriteData;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type { Meta, StoryObj } from '@storybook/react';

import { OpeningInfo } from './OpeningInfo';

const meta = {
component: OpeningInfo,
} satisfies Meta<typeof OpeningInfo>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Closed: Story = {
args: {
regularOpeningHours: {
hours: [
{ status: 'CLOSED', dayName: 'monday' },
{ status: 'CLOSED', dayName: 'tuesday' },
{ status: 'CLOSED', dayName: 'wednesday' },
{ status: 'CLOSED', dayName: 'thursday' },
{ status: 'CLOSED', dayName: 'friday' },
{ status: 'CLOSED', dayName: 'saturday' },
{ status: 'CLOSED', dayName: 'sunday' },
],
},
specialOpeningHours: {
validFrom: '2023-03-01T00:00:00Z',
validTo: '2050-03-01T00:00:00Z',
},
},
};

export const Open: Story = {
args: {
regularOpeningHours: {
hours: [
{ status: 'OPEN', dayName: 'monday', from: '00:00', to: '23:59' },
{ status: 'OPEN', dayName: 'tuesday', from: '00:00', to: '23:59' },
{ status: 'OPEN', dayName: 'wednesday', from: '00:00', to: '23:59' },
{ status: 'OPEN', dayName: 'thursday', from: '00:00', to: '23:59' },
{ status: 'OPEN', dayName: 'friday', from: '00:00', to: '23:59' },
{ status: 'OPEN', dayName: 'saturday', from: '00:00', to: '23:59' },
{ status: 'OPEN', dayName: 'sunday', from: '00:00', to: '23:59' },
],
},
specialOpeningHours: {
validFrom: '2023-01-01T00:00:00Z',
validTo: '2050-01-01T00:00:00Z',
},
},
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect, useState } from 'react';
import { Loader } from '@navikt/ds-react';
import { getCurrentOpeningHours } from 'components/_common/contact-option/opening-info/helpers/openingInfoUtils';
import { getCurrentOpeningHours } from 'components/_common/contact-option/openingInfo/helpers/openingInfoUtils';
import { usePageContentProps } from 'store/pageContext';
import { OpeningHours } from 'components/_common/contact-option/opening-info/helpers/openingInfoTypes';
import { getOpeningInfoText } from 'components/_common/contact-option/opening-info/helpers/openingInfoText';
import { processOpeningHours } from 'components/_common/contact-option/opening-info/helpers/processOpeningHours';
import { OpeningHours } from 'components/_common/contact-option/openingInfo/helpers/openingInfoTypes';
import { getOpeningInfoText } from 'components/_common/contact-option/openingInfo/helpers/openingInfoText';
import { processOpeningHours } from 'components/_common/contact-option/openingInfo/helpers/processOpeningHours';

import TextWithIndicator from 'components/_common/textWithIndicator/TextWithIndicator';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { processOpeningHours } from 'components/_common/contact-option/opening-info/helpers/processOpeningHours';
import { getCurrentOpeningHours } from 'components/_common/contact-option/opening-info/helpers/openingInfoUtils';
import { getOpeningInfoText } from 'components/_common/contact-option/opening-info/helpers/openingInfoText';
import { processOpeningHours } from 'components/_common/contact-option/openingInfo/helpers/processOpeningHours';
import { getCurrentOpeningHours } from 'components/_common/contact-option/openingInfo/helpers/openingInfoUtils';
import { getOpeningInfoText } from 'components/_common/contact-option/openingInfo/helpers/openingInfoText';
import { translator } from 'translations';
import {
OpeningHourRegularRaw,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import timezone from 'dayjs/plugin/timezone';
import {
OpeningHours,
OpeningHoursOpen,
} from 'components/_common/contact-option/opening-info/helpers/openingInfoTypes';
} from 'components/_common/contact-option/openingInfo/helpers/openingInfoTypes';
import { Language, translator } from 'translations';
import { norwayTz } from 'utils/datetime';
import {
getOpeningHoursForDateTime,
openingHourDateFormat,
openingHourTimeFormat,
} from 'components/_common/contact-option/opening-info/helpers/openingInfoUtils';
} from 'components/_common/contact-option/openingInfo/helpers/openingInfoUtils';

dayjs.extend(utc);
dayjs.extend(timezone);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
import { daysNameArray, norwayTz } from 'utils/datetime';
import { OpeningHours } from 'components/_common/contact-option/opening-info/helpers/openingInfoTypes';
import { OpeningHours } from 'components/_common/contact-option/openingInfo/helpers/openingInfoTypes';

dayjs.extend(utc);
dayjs.extend(timezone);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import customParseFormat from 'dayjs/plugin/customParseFormat';
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
import { openingHourDateFormat } from 'components/_common/contact-option/opening-info/helpers/openingInfoUtils';
import { openingHourDateFormat } from 'components/_common/contact-option/openingInfo/helpers/openingInfoUtils';
import { dayNameToIndex, daysNameArray } from 'utils/datetime';
import { OpeningHours } from 'components/_common/contact-option/opening-info/helpers/openingInfoTypes';
import { OpeningHours } from 'components/_common/contact-option/openingInfo/helpers/openingInfoTypes';
import {
OpeningHourRaw,
OpeningHourRegularRaw,
Expand Down
21 changes: 0 additions & 21 deletions src/components/_common/headers/featured-header/DateLine.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { Meta, StoryObj } from '@storybook/react';

import { DateLine } from './DateLine';

const meta = {
component: DateLine,
} satisfies Meta<typeof DateLine>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
content: {
modifiedTime: '2023-07-03T07:02:26.724412Z',
createdTime: '2023-07-03T07:02:26.724412Z',
language: 'no',
},
},
};

export const English: Story = {
args: {
content: {
...Default.args.content,
language: 'en',
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Detail } from '@navikt/ds-react';
import { getPublishedAndModifiedString, GetPublishedAndModifiedStringProps } from 'utils/datetime';

import styles from './DateLine.module.scss';

export const DateLine = ({ content }: GetPublishedAndModifiedStringProps) => {
const dateString = getPublishedAndModifiedString({ content });

return (
<div className={styles.dateLine}>
<div className={styles.container}>
<Detail className={styles.dateLabel}>{dateString}</Detail>
</div>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { Meta, StoryObj } from '@storybook/react';

import { FeaturedHeader } from './FeaturedHeader';

const meta = {
component: FeaturedHeader,
} satisfies Meta<typeof FeaturedHeader>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
contentProps: {
displayName: 'displayNameFallback',
modifiedTime: '2023-07-03T07:02:26.724412Z',
createdTime: '2023-07-03T07:02:26.724412Z',
data: {
title: 'Featured Header',
},
},
},
};
Loading
Loading