-
Notifications
You must be signed in to change notification settings - Fork 29
Update react-crossword and unify usage across articles and editions #13876
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
Conversation
Size Change: -741 B (-0.08%) Total Size: 973 kB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
A few comments but all non-blocking, let's look at them in a follow-up PR after this is merged?
crosswords: FEEditionsCrossword[]; | ||
}; | ||
|
||
type FECrosswordEntry = { | ||
id: string; | ||
number: number; | ||
humanNumber: string; | ||
direction: 'across' | 'down'; | ||
position: { x: number; y: number }; | ||
separatorLocations: { | ||
','?: number[]; | ||
'-'?: number[]; | ||
}; | ||
length: number; | ||
clue: string; | ||
group: string[]; | ||
solution?: string; | ||
format?: string; | ||
}; | ||
|
||
type FECrosswordDimensions = { | ||
cols: number; | ||
rows: number; | ||
}; | ||
import type { CAPICrossword } from '@guardian/react-crossword/dist/@types/CAPI'; | ||
|
||
export type FEEditionsCrossword = { | ||
name: string; | ||
type: string; | ||
number: number; | ||
date: string; | ||
dimensions: FECrosswordDimensions; | ||
entries: FECrosswordEntry[]; | ||
solutionAvailable: boolean; | ||
hasNumbers: boolean; | ||
randomCluesOrdering: boolean; | ||
instructions?: string; | ||
creator?: { name: string; webUrl: string }; | ||
pdf?: string; | ||
annotatedSolution?: string; | ||
dateSolutionAvailable: string; | ||
export type CAPICrosswords = { | ||
newCrosswords: CAPICrossword[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: we should probably avoid importing from this directory. In the article crossword player we have something like this to get access to this type:
import type { CrosswordProps } from '@guardian/react-crossword';
type CAPICrossword = CrosswordProps['data'];
pdf?: string; | ||
annotatedSolution?: string; | ||
dateSolutionAvailable: string; | ||
export type CAPICrosswords = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: we should probably still call this FEEditionsCrosswords
across the codebase for consistency.
@@ -1,14 +1,11 @@ | |||
import Crossword from '@guardian/react-crossword'; | |||
import { Crossword } from '@guardian/react-crossword'; | |||
import type { CAPICrossword } from '@guardian/react-crossword/dist/@types/CAPI'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: we should probably avoid importing from this directory. In the article crossword player we have something like this to get access to this type:
import type { CrosswordProps } from '@guardian/react-crossword';
type CAPICrossword = CrosswordProps['data'];
@@ -1,14 +1,7 @@ | |||
/* eslint-disable ssr-friendly/no-dom-globals-in-module-scope */ | |||
// @ts-expect-error: Cannot find module | |||
import css from '@guardian/react-crossword/lib/index.css'; | |||
import type { CAPICrossword } from '@guardian/react-crossword/dist/@types/CAPI'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: we should probably avoid importing from this directory. In the article crossword player we have something like this to get access to this type:
import type { CrosswordProps } from '@guardian/react-crossword';
type CAPICrossword = CrosswordProps['data'];
@@ -1,8 +1,8 @@ | |||
import type { FEEditionsCrossword } from '../../src/types/editionsCrossword'; | |||
import type { CAPICrossword } from '@guardian/react-crossword/dist/@types/CAPI'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: we should probably avoid importing from this directory. In the article crossword player we have something like this to get access to this type:
import type { CrosswordProps } from '@guardian/react-crossword';
type CAPICrossword = CrosswordProps['data'];
Seen on PROD (merged by @DanielCliftonGuardian 7 minutes and 50 seconds ago) Please check your changes! |
What does this change?
Updates the react-crossword dependency to the latest version. This change standardises the usage of the module for both crossword articles and editions, leveraging the latest features and fixes.
This change relies on an update to the editions crossword data model guardian/frontend#27943
Why?
Resolves #13864
Screenshots