-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial addition of crossword player
this is a first pass, it needs work
- Loading branch information
Showing
19 changed files
with
1,041 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ | |
"@guardian/libs": "19.2.1", | ||
"@guardian/ophan-tracker-js": "2.2.5", | ||
"@guardian/react-crossword": "2.0.2", | ||
"@guardian/react-crossword-next": "npm:@guardian/[email protected]", | ||
"@guardian/shimport": "1.0.2", | ||
"@guardian/source": "8.0.0", | ||
"@guardian/source-development-kitchen": "12.0.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,24 @@ if (pkg.devDependencies) { | |
process.exit(1); | ||
} | ||
|
||
const mismatches = Object.entries(pkg.dependencies).filter( | ||
([, version]) => | ||
!semver.valid(version) && !version.startsWith('workspace:'), | ||
); | ||
/** | ||
* We don't check packages that are not semver-compatible | ||
* @type {RegExp[]} | ||
*/ | ||
const exceptions = /** @type {const} */ ([ | ||
/npm:@guardian\/[email protected]/, | ||
]); | ||
|
||
const mismatches = Object.entries(pkg.dependencies) | ||
.filter( | ||
([, version]) => | ||
!exceptions.some((exception) => exception.test(version)), | ||
) | ||
|
||
.filter( | ||
([, version]) => | ||
!semver.valid(version) && !version.startsWith('workspace:'), | ||
); | ||
|
||
if (mismatches.length !== 0) { | ||
warn('dotcom-rendering dependencies should be pinned.'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Crossword as ReactCrossword } from '@guardian/react-crossword-next'; | ||
import type { CrosswordProps } from '@guardian/react-crossword-next'; | ||
|
||
export const Crossword = ({ data }: CrosswordProps) => ( | ||
<ReactCrossword data={data} clueMinWidth={150} /> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { css } from '@emotion/react'; | ||
import { | ||
textEgyptian17, | ||
textEgyptianBold17, | ||
} from '@guardian/source/foundations'; | ||
|
||
const instructionsStyles = css` | ||
${textEgyptian17}; | ||
white-space: pre-line; | ||
`; | ||
|
||
const headerStyles = css` | ||
${textEgyptianBold17}; | ||
white-space: pre-line; | ||
`; | ||
|
||
export const CrosswordInstructions = ({ | ||
instructions, | ||
className, | ||
}: { | ||
instructions: string; | ||
className?: string; | ||
}) => ( | ||
<div css={instructionsStyles} className={className}> | ||
<strong css={headerStyles}>Special instructions: </strong> | ||
{instructions} | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { css } from '@emotion/react'; | ||
import { isUndefined } from '@guardian/libs'; | ||
import { textSans15 } from '@guardian/source/foundations'; | ||
import { palette } from '../palette'; | ||
|
||
const crosswordLinkStyles = css` | ||
${textSans15}; | ||
a { | ||
color: ${palette('--standfirst-link-text')}; | ||
text-decoration: none; | ||
:hover { | ||
border-bottom: 1px solid ${palette('--standfirst-link-border')}; | ||
} | ||
} | ||
`; | ||
|
||
export const CrosswordLinks = ({ | ||
crossword, | ||
className, | ||
}: { | ||
crossword: GuardianCrossword; | ||
className?: string; | ||
}) => { | ||
return ( | ||
isUndefined(crossword.pdf) || ( | ||
<span css={crosswordLinkStyles} className={className}> | ||
<a target="_blank" href={crossword.pdf} rel="noreferrer"> | ||
PDF version | ||
</a> | ||
</span> | ||
) | ||
); | ||
}; |
Oops, something went wrong.