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

Adds heading size to design model #1245

Merged
merged 5 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/proud-ties-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@guardian/support-dotcom-components': minor
---

Adds a new optional field for fonts to the model for Configurable Design banners
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ See [architecture](docs/architecture.md) for details.
This project uses [nvm](https://github.com/nvm-sh/nvm). You should run `nvm use` in your terminal before running any of the following commands. To set up, first run

```bash
pnpm
pnpm install
```

This will install all the project dependencies.
Expand Down Expand Up @@ -77,7 +77,7 @@ The `/src` directory contains 3 subdirectories:

Releasing to NPM is handled with [changesets] and is performed by CI.

On your feature branch, before merging, run `pnpm dotcom changeset` from the root of the project. This will
On your feature branch, before merging, run `pnpm changeset` from the root of the project. This will
interactively ask you what kind of change this is (major, minor, patch) and
allow you to describe the change. Commit the generated changeset file to git and
push to your branch.
Expand Down
5 changes: 5 additions & 0 deletions src/server/factories/bannerDesign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export default Factory.define<BannerDesignFromTool>(() => ({
'https://i.guim.co.uk/img/media/6c933a058d1ce37a5ad17f79895906150812dfee/0_0_1768_1420/500.png?width=500&quality=75&s=9277532ddf184a308e14218e3576543b',
altText: 'Example alt text',
},
fonts: {
heading: {
size: 'medium',
},
},
colours: {
basic: {
background: stringToHexColour('F1F8FC'),
Expand Down
9 changes: 9 additions & 0 deletions src/shared/types/props/design.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,18 @@ interface ChoiceCardsDesign {
}
type Visual = BannerDesignImage | ChoiceCardsDesign;

type FontSize = 'small' | 'medium' | 'large';

interface Font {
size: FontSize;
}

export interface ConfigurableDesign {
visual?: Visual;
headerImage?: BannerDesignHeaderImage;
fonts?: {
heading: Font;
};
colours: {
basic: {
background: HexColour;
Expand Down
Loading