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

fix(campaign-news): Adjust initial article height with font's lineHeight #1787

Merged
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
10 changes: 7 additions & 3 deletions src/components/client/campaign-news/CampaignNewsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ type Props = {

export default function CampaignNewsList({ articles }: Props) {
const { t, i18n } = useTranslation('news')
const INITIAL_HEIGHT_LIMIT = 400

const LINE_HEIGHT = theme.typography.body1.lineHeight
const INITIAL_HEIGHT_LIMIT = 400 * Number(LINE_HEIGHT)
const [isExpanded, expandContent] = useShowMoreContent()
return (
<>
Expand Down Expand Up @@ -131,10 +133,12 @@ export default function CampaignNewsList({ articles }: Props) {
maxWidth: 1200,
}}>
<Grid container item direction={'column'} gap={1}>
<Typography className={classes.articleHeader}>{article.title}</Typography>
<Typography component={'h2'} className={classes.articleHeader}>
{article.title}
</Typography>
<QuillStypeWrapper>
<Typography
component={'div'}
component={'article'}
className={classes.articleDescription}
dangerouslySetInnerHTML={{
__html: sanitizedDescription,
Expand Down
11 changes: 7 additions & 4 deletions src/components/client/campaigns/CampaignNewsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const StyledTimeline = styled(Timeline)(({ theme }) => ({
padding: 0,
},

[`div.${classes.articleDescription} > p`]: {
[`article.${classes.articleDescription} > p`]: {
margin: 0,
},

Expand Down Expand Up @@ -162,7 +162,8 @@ export default function CampaignNewsSection({ campaign, canCreateArticle }: Prop
const { t, i18n } = useTranslation('news')
const { small }: { small: boolean } = useMobile()

const INITIAL_HEIGHT_LIMIT = 200
const LINE_HEIGHT = theme.typography.body1.lineHeight
const INITIAL_HEIGHT_LIMIT = 200 * Number(LINE_HEIGHT)
const [isExpanded, expandContent] = useShowMoreContent()

return (
Expand Down Expand Up @@ -249,7 +250,9 @@ export default function CampaignNewsSection({ campaign, canCreateArticle }: Prop
)}
<Grid container gap={1} direction={'column'} className={classes.articleContent}>
<Grid item>
<Typography className={classes.articleHeader}>{article.title}</Typography>
<Typography component={'h2'} className={classes.articleHeader}>
{article.title}
</Typography>
</Grid>
<Grid
container
Expand All @@ -265,7 +268,7 @@ export default function CampaignNewsSection({ campaign, canCreateArticle }: Prop
}}>
<QuillStypeWrapper>
<Typography
component={'div'}
component={'article'}
className={classes.articleDescription}
dangerouslySetInnerHTML={{
__html: sanitizedDescription,
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/QuillStyleWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const QuillStypeWrapper = styled(Grid)(({ theme }) => ({
},

['p']: {
fontSize: theme.spacing(2),
fontSize: theme.typography.pxToRem(16),
fontWeight: 400,
lineHeight: theme.spacing(2.85),
},
Expand Down
Loading