-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #442 from WestpacGEL/feature/article-site-updates
feature(site): update article layouts and fix some content bugs
- Loading branch information
Showing
30 changed files
with
414 additions
and
153 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
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
14 changes: 7 additions & 7 deletions
14
apps/site/src/app/articles/[article]/components/heading/heading.style.ts
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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { tv } from 'tailwind-variants'; | ||
|
||
export const styles = tv({ | ||
base: 'mt-7 font-bold xsl:mt-9', | ||
base: 'col-span-12 font-bold xsl:col-span-10 xsl:col-start-2 md:col-span-8 md:col-start-3', | ||
variants: { | ||
textAlign: { | ||
left: 'text-left', | ||
center: 'text-center', | ||
end: 'text-right', | ||
}, | ||
level: { | ||
1: 'typography-site-5 mb-5', | ||
2: 'typography-site-7 mb-4 !leading-loose xsl:typography-site-6 xsl:mb-5', | ||
3: 'typography-site-7 mb-5', | ||
4: 'typography-site-9 mb-5', | ||
5: 'typography-site-10 mb-2', | ||
6: 'typography-site-10 mb-2', | ||
1: 'typography-site-5', | ||
2: 'typography-site-7 mb-4 leading-[1.3] xsl:typography-site-6 xsl:mb-5 xsl:leading-[1.3]', | ||
3: 'typography-site-8 mb-3 leading-[1.3] xsl:typography-site-7 xsl:leading-[1.3]', | ||
4: 'typography-site-8 mb-3 leading-[1.3]', | ||
5: 'typography-site-10', | ||
6: 'typography-site-10', | ||
}, | ||
}, | ||
}); |
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
2 changes: 2 additions & 0 deletions
2
apps/site/src/app/articles/[article]/components/layout/index.ts
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,2 @@ | ||
export * from './layout.component'; | ||
export * from './layout.types'; |
25 changes: 25 additions & 0 deletions
25
apps/site/src/app/articles/[article]/components/layout/layout.component.tsx
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,25 @@ | ||
import { Item } from '@westpac/ui'; | ||
|
||
import { styles } from './layout.styles'; | ||
import { type LayoutProps, type Variants } from './layout.types'; | ||
import { layoutMap } from './layout.utils'; | ||
|
||
export const Layout = ({ children, layout }: LayoutProps) => { | ||
return ( | ||
<> | ||
{children.map((child, index) => { | ||
const width = layout[index]; | ||
return ( | ||
<Item | ||
key={index} | ||
span={layoutMap[width].span} | ||
start={layoutMap[width].start[index]} | ||
className={styles({ index: index as Variants['index'] })} | ||
> | ||
{child} | ||
</Item> | ||
); | ||
})} | ||
</> | ||
); | ||
}; |
10 changes: 10 additions & 0 deletions
10
apps/site/src/app/articles/[article]/components/layout/layout.styles.ts
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,10 @@ | ||
import { tv } from 'tailwind-variants'; | ||
|
||
export const styles = tv({ | ||
base: 'mb-7 xsl:mb-9', | ||
variants: { | ||
index: { | ||
0: 'mb-4', | ||
}, | ||
}, | ||
}); |
11 changes: 11 additions & 0 deletions
11
apps/site/src/app/articles/[article]/components/layout/layout.types.ts
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,11 @@ | ||
import { ReactElement } from 'react'; | ||
import { type VariantProps } from 'tailwind-variants'; | ||
|
||
import { styles } from './layout.styles.js'; | ||
|
||
export type LayoutProps = { | ||
children: ReactElement[]; | ||
layout: [number, ...number[]]; | ||
}; | ||
|
||
export type Variants = VariantProps<typeof styles>; |
38 changes: 38 additions & 0 deletions
38
apps/site/src/app/articles/[article]/components/layout/layout.utils.ts
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,38 @@ | ||
export const layoutMap: { [key: number]: { span: object; start: { [index: number]: object } } } = { | ||
// body | ||
4: { | ||
span: { | ||
initial: 12, | ||
xsl: 5, | ||
md: 4, | ||
}, | ||
start: { | ||
0: { | ||
inital: 1, | ||
xsl: 2, | ||
md: 3, | ||
}, | ||
1: { | ||
initial: 1, | ||
xsl: 7, | ||
}, | ||
}, | ||
}, | ||
//body-wide | ||
5: { | ||
span: { | ||
initial: 12, | ||
xsl: 5, | ||
}, | ||
start: { | ||
0: { | ||
initial: 1, | ||
xsl: 2, | ||
}, | ||
1: { | ||
intial: 1, | ||
xsl: 7, | ||
}, | ||
}, | ||
}, | ||
}; |
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
15 changes: 10 additions & 5 deletions
15
...omponents/component-blocks/components/article-body-image/article-body-image.component.tsx
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 |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import { Item } from '@westpac/ui/grid'; | ||
|
||
import { styles as ArticleBodyImageStyles } from './article-body-image.style'; | ||
import { type ArticleBodyImageProps } from './article-body-image.types'; | ||
import { layoutMap } from './article-body-image.utils'; | ||
|
||
export const ArticleBodyImage = ({ articleBodyImage, alt, title }: ArticleBodyImageProps) => { | ||
export const ArticleBodyImage = ({ articleBodyImage, alt, title, type = 'body' }: ArticleBodyImageProps) => { | ||
const styles = ArticleBodyImageStyles({}); | ||
return ( | ||
<figure className={styles.base({})}> | ||
<img className={styles.img({})} loading="lazy" alt={alt} src={articleBodyImage} /> | ||
{title && <figcaption className={styles.caption({})}>{title}</figcaption>} | ||
</figure> | ||
<Item span={layoutMap[type].span} start={layoutMap[type].start}> | ||
<figure className={styles.base({})}> | ||
<img className={styles.img({})} loading="lazy" alt={alt} src={articleBodyImage} /> | ||
{title && <figcaption className={styles.caption({})}>{title}</figcaption>} | ||
</figure> | ||
</Item> | ||
); | ||
}; |
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
3 changes: 3 additions & 0 deletions
3
...src/components/component-blocks/components/article-body-image/article-body-image.types.ts
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
export type Width = 'body' | 'bodyWide'; | ||
|
||
export type ArticleBodyImageProps = { | ||
alt?: string; | ||
articleBodyImage?: string; | ||
title?: string; | ||
type?: Width; | ||
}; |
26 changes: 26 additions & 0 deletions
26
...src/components/component-blocks/components/article-body-image/article-body-image.utils.ts
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,26 @@ | ||
import { type Width } from './article-body-image.types'; | ||
|
||
export const layoutMap: Record<Width, { span: object; start: object }> = { | ||
body: { | ||
span: { | ||
initial: 12, | ||
xsl: 10, | ||
md: 8, | ||
}, | ||
start: { | ||
initial: 1, | ||
xsl: 2, | ||
md: 3, | ||
}, | ||
}, | ||
bodyWide: { | ||
span: { | ||
initial: 12, | ||
xsl: 10, | ||
}, | ||
start: { | ||
initial: 1, | ||
xsl: 2, | ||
}, | ||
}, | ||
}; |
2 changes: 1 addition & 1 deletion
2
apps/site/src/components/component-blocks/components/leading-text/leading-text.style.ts
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { tv } from 'tailwind-variants'; | ||
|
||
export const styles = tv({ | ||
base: 'typography-site-8 mx-0 mb-7 leading-[1.6] xsl:typography-site-7 xsl:mb-9 xsl:leading-[1.6] md:-mx-17', | ||
base: 'typography-site-8 col-span-12 mx-0 mb-7 leading-[1.6] xsl:typography-site-7 xsl:col-span-10 xsl:col-start-2 xsl:mb-9 xsl:leading-[1.6]', | ||
}); |
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
Oops, something went wrong.
e01cece
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.
Successfully deployed to the following URLs:
gel-next-site – ./apps/site
gel-next-site.vercel.app
gel-next-site-git-main-westpacgel.vercel.app
gel-next-site-westpacgel.vercel.app