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

Use local copy of article format types in DCR #12461

Merged
merged 4 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ArticleFormat,
ArticleSpecial,
Pillar,
} from '@guardian/libs';
} from '../../src/lib/format';
import {
palette as sourcePalette,
space,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
type StoryContext,
type StrictArgs,
} from '@storybook/react';
import { ArticleFormat } from '@guardian/libs';
import { ArticleFormat } from '../../src/lib/format';
import type { CSSProperties } from 'react';

const darkStoryCss = css`
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/.storybook/mocks/paletteDeclarations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArticleFormat } from '@guardian/libs';
import { ArticleFormat } from '../../src/lib/format';
import { paletteDeclarations } from '../../src/palette';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ArticleDesign,
Pillar,
type ArticleFormat,
} from '@guardian/libs';
} from '../../src/lib/format';

const defaultFormat: ArticleFormat = {
display: ArticleDisplay.Standard,
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/fixtures/manual/guideAtom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import { ArticleDesign, ArticleDisplay, Pillar } from '../../src/lib/format';

export const defaultStoryExpanded = {
id: 'a76d998e-d4b0-4d00-8afb-773eddb4064c',
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/fixtures/manual/key-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ArticleDisplay,
type ArticleFormat,
Pillar,
} from '@guardian/libs';
} from '../../src/lib/format';

export interface KeyEventCard {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/fixtures/manual/trails-nav.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import { ArticleDesign, ArticleDisplay, Pillar } from '../../src/lib/format';
import type { TrailType } from '../../src/types/trails';

export const trails: [
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/fixtures/manual/trails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ArticleDisplay,
type ArticleFormat,
Pillar,
} from '@guardian/libs';
} from '../../src/lib/format';
import type { DCRFrontCard } from '../../src/types/front';
import { discussionApiUrl } from './discussionApiUrl';

Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/scripts/gen-stories/get-stories.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ const CARD_TEMPLATE_HEADER = `
* These stories were auto-generated by \`dotcom-rendering/scripts/gen-stories/gen-stories.js\`
*/

import { ArticleDesign, ArticleDisplay, ArticleSpecial, Pillar } from '@guardian/libs';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
import { CardsWithDifferentThemes } from '../../src/components/Card/Card.stories';
import { ArticleDesign, ArticleDisplay, ArticleSpecial, Pillar } from '../../src/lib/format';

// eslint-disable-next-line import/no-default-export -- we need a default here
export default {
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/components/AdSlot.web.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { css } from '@emotion/react';
import type { SlotName } from '@guardian/commercial';
import { adSizes, constants } from '@guardian/commercial';
import { ArticleDisplay } from '@guardian/libs';
import {
between,
breakpoints,
Expand All @@ -12,6 +11,7 @@ import {
until,
} from '@guardian/source/foundations';
import { Hide } from '@guardian/source/react-components';
import { ArticleDisplay } from '../lib/format';
import { getZIndex } from '../lib/getZIndex';
import { LABS_HEADER_HEIGHT } from '../lib/labs-constants';
import { palette as schemedPalette } from '../palette';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Global } from '@emotion/react';
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import { StrictMode } from 'react';
import { AllEditorialNewslettersPageLayout } from '../layouts/AllEditorialNewslettersPageLayout';
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/format';
import { rootStyles } from '../lib/rootStyles';
import type { NavType } from '../model/extract-nav';
import type { DCRNewslettersPageType } from '../types/newslettersPage';
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/components/Answers.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { css } from '@emotion/react';
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import { Radio, RadioGroup } from '@guardian/source/react-components';
import type { Meta, StoryObj } from '@storybook/react';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/format';
import {
CorrectSelectedAnswer,
IncorrectAnswer,
Expand Down
3 changes: 1 addition & 2 deletions dotcom-rendering/src/components/Answers.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { css } from '@emotion/react';
import type { ArticleTheme } from '@guardian/libs';
import { ArticleSpecial } from '@guardian/libs';
import {
article17,
palette,
Expand All @@ -9,6 +7,7 @@ import {
textSans17,
} from '@guardian/source/foundations';
import { SvgCheckmark, SvgCross } from '@guardian/source/react-components';
import { ArticleSpecial, type ArticleTheme } from '../lib/format';
import { palette as schemedPalette } from '../palette';

// We export Radio wrapper styles to override Source Radio buttons to align
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import type { Meta, StoryObj } from '@storybook/react';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/format';
import { AppsEpic as AppsEpicComponent } from './AppsEpic.importable';

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import type { Meta, StoryObj } from '@storybook/react';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/format';
import { AppsFooter as AppsFooterComponent } from './AppsFooter.importable';

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@emotion/react';
import type { ArticleFormat } from '@guardian/libs';
import type { ArticleFormat } from '../lib/format';
import { type RoleType } from '../types/content';
import { openLightboxForImageId } from './AppsLightboxImageStore.importable';
import type { Loading } from './CardPicture';
Expand Down
7 changes: 5 additions & 2 deletions dotcom-rendering/src/components/ArticleBody.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { css } from '@emotion/react';
import { ArticleDesign, ArticleDisplay } from '@guardian/libs';
import type { ArticleFormat } from '@guardian/libs';
import {
between,
headlineBold24,
Expand All @@ -9,6 +7,11 @@ import {
} from '@guardian/source/foundations';
import { ArticleRenderer } from '../lib/ArticleRenderer';
import type { EditionId } from '../lib/edition';
import {
ArticleDesign,
ArticleDisplay,
type ArticleFormat,
} from '../lib/format';
import { decideLanguage, decideLanguageDirection } from '../lib/lang';
import { revealStyles } from '../lib/revealStyles';
import { palette as themePalette } from '../palette';
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/components/ArticleContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from '@emotion/react';
import { adSizes, constants } from '@guardian/commercial';
import { ArticleDesign, type ArticleFormat } from '@guardian/libs';
import { from, space, until } from '@guardian/source/foundations';
import { ArticleDesign, type ArticleFormat } from '../lib/format';
import { palette } from '../palette';
import { carrotAdStyles, labelStyles } from './AdSlot.web';

Expand Down
8 changes: 4 additions & 4 deletions dotcom-rendering/src/components/ArticleHeadline.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { css } from '@emotion/react';
import type { Meta, StoryObj } from '@storybook/react';
import { centreColumnDecorator } from '../../.storybook/decorators/gridDecorators';
import { allModes } from '../../.storybook/modes';
import {
ArticleDesign,
ArticleDisplay,
ArticleSpecial,
Pillar,
} from '@guardian/libs';
import type { Meta, StoryObj } from '@storybook/react';
import { centreColumnDecorator } from '../../.storybook/decorators/gridDecorators';
import { allModes } from '../../.storybook/modes';
} from '../lib/format';
import { formatToString, getAllThemes } from '../lib/format';
import { palette } from '../palette';
import { ArticleHeadline } from './ArticleHeadline';
Expand Down
14 changes: 7 additions & 7 deletions dotcom-rendering/src/components/ArticleHeadline.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import { css } from '@emotion/react';
import {
ArticleDesign,
ArticleDisplay,
ArticleSpecial,
Pillar,
} from '@guardian/libs';
import type { ArticleFormat } from '@guardian/libs';
import {
from,
headlineBold28,
Expand All @@ -24,6 +17,13 @@ import {
} from '@guardian/source/foundations';
import { interactiveLegacyClasses } from '../layouts/lib/interactiveLegacyStyling';
import { getAgeWarning } from '../lib/age-warning';
import {
ArticleDesign,
ArticleDisplay,
type ArticleFormat,
ArticleSpecial,
Pillar,
} from '../lib/format';
import { getZIndex } from '../lib/getZIndex';
import { palette as themePalette } from '../palette';
import type { TagType } from '../types/tag';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from '@emotion/react';
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import type { Meta, StoryObj } from '@storybook/react';
import { allModes } from '../../.storybook/modes';
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/format';
import { palette } from '../palette';
import { ArticleLastUpdated } from './ArticleLastUpdated';

Expand Down
3 changes: 2 additions & 1 deletion dotcom-rendering/src/components/ArticleLastUpdated.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { css } from '@emotion/react';
import { ArticleDesign, type ArticleFormat, timeAgo } from '@guardian/libs';
import { timeAgo } from '@guardian/libs';
import { textSans15, textSansBold15 } from '@guardian/source/foundations';
import { ArticleDesign, type ArticleFormat } from '../lib/format';
import { palette } from '../palette';
import { Island } from './Island';
import { PulsingDot } from './PulsingDot.importable';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import type { Meta, StoryObj } from '@storybook/react';
import { leftColumnDecorator } from '../../.storybook/decorators/gridDecorators';
import { defaultFormats } from '../../.storybook/decorators/splitThemeDecorator';
import { allModes } from '../../.storybook/modes';
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/format';
import { getAllThemes } from '../lib/format';
import { ArticleMetaApps } from './ArticleMeta.apps';

Expand Down
5 changes: 3 additions & 2 deletions dotcom-rendering/src/components/ArticleMeta.apps.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { css } from '@emotion/react';
import type { ArticleFormat } from '@guardian/libs';
import { ArticleDesign, ArticleDisplay, isUndefined } from '@guardian/libs';
import { isUndefined } from '@guardian/libs';
import { from, space, until } from '@guardian/source/foundations';
import { StraightLines } from '@guardian/source-development-kitchen/react-components';
import type { ReactNode } from 'react';
import { interactiveLegacyClasses } from '../layouts/lib/interactiveLegacyStyling';
import { getSoleContributor } from '../lib/byline';
import { ArticleDesign, ArticleDisplay } from '../lib/format';
import type { ArticleFormat } from '../lib/format';
import { palette as themePalette } from '../palette';
import type { Branding as BrandingType } from '../types/branding';
import type { TagType } from '../types/tag';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { css } from '@emotion/react';
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import {
from,
palette as sourcePalette,
Expand All @@ -10,6 +9,7 @@ import type { Meta, StoryObj } from '@storybook/react';
import { leftColumnDecorator } from '../../.storybook/decorators/gridDecorators';
import { defaultFormats } from '../../.storybook/decorators/splitThemeDecorator';
import { allModes } from '../../.storybook/modes';
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/format';
import { getAllThemes } from '../lib/format';
import { palette } from '../palette';
import { ArticleMeta } from './ArticleMeta.web';
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/components/ArticleMeta.web.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import { render } from '@testing-library/react';
import { interactiveLegacyClasses } from '../layouts/lib/interactiveLegacyStyling';
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/format';
import { ArticleMeta, shouldShowContributor } from './ArticleMeta.web';
import { ConfigProvider } from './ConfigContext';

Expand Down
8 changes: 6 additions & 2 deletions dotcom-rendering/src/components/ArticleMeta.web.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { css } from '@emotion/react';
import type { ArticleFormat } from '@guardian/libs';
import { ArticleDesign, ArticleDisplay, ArticleSpecial } from '@guardian/libs';
import { between, from, space, until } from '@guardian/source/foundations';
import { StraightLines } from '@guardian/source-development-kitchen/react-components';
import { interactiveLegacyClasses } from '../layouts/lib/interactiveLegacyStyling';
import { getSoleContributor } from '../lib/byline';
import {
ArticleDesign,
ArticleDisplay,
type ArticleFormat,
ArticleSpecial,
} from '../lib/format';
import { palette as themePalette } from '../palette';
import type { Branding as BrandingType } from '../types/branding';
import type { TagType } from '../types/tag';
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/components/ArticlePage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Global } from '@emotion/react';
import { ArticleDesign, type ArticleFormat } from '@guardian/libs';
import { StrictMode } from 'react';
import { DecideLayout } from '../layouts/DecideLayout';
import { buildAdTargeting } from '../lib/ad-targeting';
import { ArticleDesign, type ArticleFormat } from '../lib/format';
import { rootStyles } from '../lib/rootStyles';
import { filterABTestSwitches } from '../model/enhance-switches';
import type { NavType } from '../model/extract-nav';
Expand Down
10 changes: 5 additions & 5 deletions dotcom-rendering/src/components/ArticleTitle.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { Meta, StoryObj } from '@storybook/react/*';
import { leftColumnDecorator } from '../../.storybook/decorators/gridDecorators';
import { defaultFormats } from '../../.storybook/decorators/splitThemeDecorator';
import { allModes } from '../../.storybook/modes';
import {
ArticleDesign,
ArticleDisplay,
ArticleSpecial,
Pillar,
} from '@guardian/libs';
import type { Meta, StoryObj } from '@storybook/react/*';
import { leftColumnDecorator } from '../../.storybook/decorators/gridDecorators';
import { defaultFormats } from '../../.storybook/decorators/splitThemeDecorator';
import { allModes } from '../../.storybook/modes';
} from '../lib/format';
import { getAllThemes } from '../lib/format';
import { ArticleTitle } from './ArticleTitle';

Expand Down
4 changes: 2 additions & 2 deletions dotcom-rendering/src/components/ArticleTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { css } from '@emotion/react';
import { from } from '@guardian/source/foundations';
import {
ArticleDesign,
ArticleDisplay,
type ArticleFormat,
} from '@guardian/libs';
import { from } from '@guardian/source/foundations';
} from '../lib/format';
import type { TagType } from '../types/tag';
import { SeriesSectionLink } from './SeriesSectionLink';

Expand Down
6 changes: 3 additions & 3 deletions dotcom-rendering/src/components/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Meta, StoryObj } from '@storybook/react';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
import {
ArticleDesign,
ArticleDisplay,
ArticleSpecial,
Pillar,
} from '@guardian/libs';
import type { Meta, StoryObj } from '@storybook/react';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
} from '../lib/format';
import { Avatar } from './Avatar';

const meta: Meta<typeof Avatar> = {
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/components/BigNumber.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { css } from '@emotion/react';
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import { space } from '@guardian/source/foundations';
import type { Meta } from '@storybook/react';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/format';
import { palette } from '../palette';
import { BigNumber } from './BigNumber';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { css } from '@emotion/react';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
import {
ArticleDesign,
ArticleDisplay,
ArticleSpecial,
Pillar,
} from '@guardian/libs';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
} from '../lib/format';
import { BlockquoteBlockComponent } from './BlockquoteBlockComponent';

const shortQuoteHtml =
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/components/Blocks.amp.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { css } from '@emotion/react';
import type { ArticleTheme } from '@guardian/libs';
import { palette, text, textSans12 } from '@guardian/source/foundations';
import { blockLink } from '../lib/block-link.amp';
import type { EditionId } from '../lib/edition';
import { findBlockAdSlots } from '../lib/find-adslots.amp';
import type { ArticleTheme } from '../lib/format';
import { pillarPalette_DO_NOT_USE } from '../lib/pillars';
import type { CommercialProperties } from '../types/commercial';
import type { Switches } from '../types/config';
Expand Down
Loading
Loading