From 61a535af532937d2ed94b0be3c3453bfee790e22 Mon Sep 17 00:00:00 2001 From: Narcha <42248344+Narcha@users.noreply.github.com> Date: Sat, 20 Aug 2022 21:28:16 +0200 Subject: [PATCH 1/2] [@mantine/core] Title: Fixed `inline` prop --- src/mantine-core/src/Title/Title.styles.ts | 5 +++-- src/mantine-core/src/Title/Title.tsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mantine-core/src/Title/Title.styles.ts b/src/mantine-core/src/Title/Title.styles.ts index 1db8c3d9631..efb6db0fcb0 100644 --- a/src/mantine-core/src/Title/Title.styles.ts +++ b/src/mantine-core/src/Title/Title.styles.ts @@ -7,6 +7,7 @@ export interface TitleStylesParams { element: HeadingElement; size: TitleSize; weight: React.CSSProperties['fontWeight']; + inline: boolean; } function getFontSize(size: TitleSize, element: HeadingElement, theme: MantineTheme) { @@ -25,13 +26,13 @@ function getLineHeight(size: TitleSize, element: HeadingElement, theme: MantineT return theme.headings.sizes[element].lineHeight; } -export default createStyles((theme, { element, weight, size }: TitleStylesParams) => ({ +export default createStyles((theme, { element, weight, size, inline }: TitleStylesParams) => ({ root: { ...theme.fn.fontStyles(), fontFamily: theme.headings.fontFamily, fontWeight: weight || theme.headings.sizes[element].fontWeight || theme.headings.fontWeight, fontSize: getFontSize(size, element, theme), - lineHeight: getLineHeight(size, element, theme), + lineHeight: inline ? 1 : getLineHeight(size, element, theme), margin: 0, }, })); diff --git a/src/mantine-core/src/Title/Title.tsx b/src/mantine-core/src/Title/Title.tsx index d85bc817921..2c191d79af6 100644 --- a/src/mantine-core/src/Title/Title.tsx +++ b/src/mantine-core/src/Title/Title.tsx @@ -22,11 +22,11 @@ const defaultProps: Partial = { }; export const Title = forwardRef((props, ref) => { - const { className, order, children, unstyled, size, weight, ...others } = + const { className, order, children, unstyled, size, weight, inline, ...others } = useComponentDefaultProps('Title', defaultProps, props); const { classes, cx } = useStyles( - { element: `h${order}`, weight, size }, + { element: `h${order}`, weight, size, inline }, { name: 'Title', unstyled } ); From 3e1758e46ab23a2fda6aad9b2472212fb5aece4c Mon Sep 17 00:00:00 2001 From: Narcha <42248344+Narcha@users.noreply.github.com> Date: Sat, 20 Aug 2022 21:30:14 +0200 Subject: [PATCH 2/2] [@mantine/core] Title: Fixed small error --- src/mantine-core/src/Title/Title.styles.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mantine-core/src/Title/Title.styles.ts b/src/mantine-core/src/Title/Title.styles.ts index efb6db0fcb0..f8553bd77bc 100644 --- a/src/mantine-core/src/Title/Title.styles.ts +++ b/src/mantine-core/src/Title/Title.styles.ts @@ -20,7 +20,7 @@ function getFontSize(size: TitleSize, element: HeadingElement, theme: MantineThe function getLineHeight(size: TitleSize, element: HeadingElement, theme: MantineTheme) { if (typeof size !== 'undefined' && size in theme.headings.sizes) { - return theme.headings.sizes[element].lineHeight; + return theme.headings.sizes[size].lineHeight; } return theme.headings.sizes[element].lineHeight;