diff --git a/libs/@guardian/react-crossword/src/utils/getCells.ts b/libs/@guardian/react-crossword/src/utils/getCells.ts index fae096ed9..9035acf84 100644 --- a/libs/@guardian/react-crossword/src/utils/getCells.ts +++ b/libs/@guardian/react-crossword/src/utils/getCells.ts @@ -20,8 +20,8 @@ const fillSeparatorCells = ({ rows: number; cols: number; }): Cells => { - for (let i = 0; i < rows; i++) { - for (let j = 0; j < cols; j++) { + for (let i = 0; i < cols; i++) { + for (let j = 0; j < rows; j++) { const currentCell = cells.get(`x${i}y${j}`); if (currentCell === undefined) { const newCell: Cell = { diff --git a/libs/@guardian/react-crossword/stories/Formats.stories.tsx b/libs/@guardian/react-crossword/stories/Formats.stories.tsx index 59a0c903e..1d415c6a6 100644 --- a/libs/@guardian/react-crossword/stories/Formats.stories.tsx +++ b/libs/@guardian/react-crossword/stories/Formats.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react'; -import { Crossword } from '../src/index'; +import { Crossword } from '../src'; import { defaultTheme } from '../src/theme'; import { cryptic } from './formats/cryptic'; import { everyman } from './formats/everyman'; @@ -9,6 +9,7 @@ import { quickCryptic } from './formats/quick-cryptic'; import { quiptic } from './formats/quiptic'; import { special } from './formats/special'; import { speedy } from './formats/speedy'; +import { uneven } from './formats/uneven'; import { weekend } from './formats/weekend'; const meta: Meta = { @@ -57,3 +58,7 @@ export const Speedy: Story = { export const Weekend: Story = { args: { data: weekend }, }; + +export const Uneven: Story = { + args: { data: uneven }, +}; diff --git a/libs/@guardian/react-crossword/stories/formats/uneven.ts b/libs/@guardian/react-crossword/stories/formats/uneven.ts new file mode 100644 index 000000000..f5b1f5d7e --- /dev/null +++ b/libs/@guardian/react-crossword/stories/formats/uneven.ts @@ -0,0 +1,175 @@ +import type { CAPICrossword } from '../../src/@types/CAPI'; + +export const uneven: CAPICrossword = { + id: 'crosswords/uneven/1', + number: 1, + name: 'Uneven crossword No 1', + creator: { + name: 'Oliver', + webUrl: 'https://www.theguardian.com/profile/maskarade', + }, + date: 1729900800000, + webPublicationDate: 1729897217000, + entries: [ + { + id: '7-across', + number: 7, + humanNumber: '7', + clue: 'Yields to Wimbledon favourites, we’re told (5)', + direction: 'across', + length: 5, + group: ['7-across'], + position: { + x: 0, + y: 2, + }, + separatorLocations: {}, + solution: 'CEDES', + }, + { + id: '9-across', + number: 9, + humanNumber: '9', + clue: 'Deafening noise of item of sports equipment heard (6)', + direction: 'across', + length: 6, + group: ['9-across'], + position: { + x: 0, + y: 4, + }, + separatorLocations: {}, + solution: 'RACKET', + }, + { + id: '13-across', + number: 13, + humanNumber: '13', + clue: 'Whitish bucket is suggested (4)', + direction: 'across', + length: 4, + group: ['13-across'], + position: { + x: 0, + y: 6, + }, + separatorLocations: {}, + solution: 'PALE', + }, + { + id: '17-across', + number: 17, + humanNumber: '17', + clue: 'Bird with the French name (5)', + direction: 'across', + length: 5, + group: ['17-across'], + position: { + x: 0, + y: 8, + }, + separatorLocations: {}, + solution: 'TITLE', + }, + { + id: '1-down', + number: 1, + humanNumber: '1', + clue: 'Parish priest and little girl by vehicle (5)', + direction: 'down', + length: 5, + group: ['1-down'], + position: { + x: 0, + y: 0, + }, + separatorLocations: {}, + solution: 'VICAR', + }, + { + id: '2-down', + number: 2, + humanNumber: '2', + clue: 'Extremist’s excellent in slang (7)', + direction: 'down', + length: 7, + group: ['2-down'], + position: { + x: 2, + y: 0, + }, + separatorLocations: {}, + solution: 'RADICAL', + }, + { + id: '3-down', + number: 3, + humanNumber: '3', + clue: 'The reply is “Warne’s out!” (6)', + direction: 'down', + length: 6, + group: ['3-down'], + position: { + x: 4, + y: 0, + }, + separatorLocations: {}, + solution: 'ANSWER', + }, + { + id: '13-down', + number: 13, + humanNumber: '13', + clue: 'Darlings step out (4)', + direction: 'down', + length: 4, + group: ['13-down'], + position: { + x: 0, + y: 6, + }, + separatorLocations: {}, + solution: 'PETS', + }, + { + id: '16-down', + number: 16, + humanNumber: '16', + clue: 'Squint at member of the House of Lords (4)', + direction: 'down', + length: 4, + group: ['16-down'], + position: { + x: 4, + y: 7, + }, + separatorLocations: {}, + solution: 'PEER', + }, + { + id: '18-down', + number: 18, + humanNumber: '18', + clue: 'Rubbish work on a shuttle (3)', + direction: 'down', + length: 3, + group: ['18-down'], + position: { + x: 2, + y: 8, + }, + separatorLocations: {}, + solution: 'TAT', + }, + ], + solutionAvailable: true, + dateSolutionAvailable: 1729897200000, + dimensions: { + cols: 7, + rows: 11, + }, + crosswordType: 'quick-cryptic', + pdf: 'https://crosswords-static.guim.co.uk/gdn.quick-cryptic.20241026.pdf', + instructions: + 'TODAY’S TRICKS Clues begin or end with a definition of the answer. The rest is one of these:\nAnagram\nAn anagram of the answer and a hint that there’s an anagram\n‘Senator arranged crime (7)’ gives TREASON\nCharade\nA combination of synonyms\n‘Qualify to get drink for ID (8)’ gives PASSPORT (pass + port)\nDouble definition\nBoth halves are definitions!\n‘Search scrub (5)’ gives SCOUR\nSoundalike\nSomething that sounds like the answer\n‘Excited as Oscar’s announced (4)’ gives WILD', +};