Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40aaa11

Browse files
committed
fix: update styles to be more based on body values
1 parent 3386d42 commit 40aaa11

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

plugins/backstage-plugin-coder/src/components/A11yInfoCard/A11yInfoCard.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
import React, { type HTMLAttributes, type ReactNode, forwardRef } from 'react';
88
import { makeStyles } from '@material-ui/core';
9+
import { scaleCssUnit } from '../../utils/styling';
910

1011
export type A11yInfoCardProps = Readonly<
1112
HTMLAttributes<HTMLDivElement> & {
@@ -23,10 +24,7 @@ const useStyles = makeStyles(theme => ({
2324
},
2425

2526
headerContent: {
26-
// Not a fan of using a random <h5> element's styles, but it's the only
27-
// typographic category that has a font size of 1.5x the base font size. We
28-
// need that size to match the header sizes of the official InfoCard.
29-
fontSize: theme.typography.h5.fontSize ?? '1.5rem',
27+
fontSize: scaleCssUnit(theme.typography.body1.fontSize, 1.5),
3028
color: theme.palette.text.primary,
3129
fontWeight: 700,
3230
borderBottom: `1px solid ${theme.palette.divider}`,

plugins/backstage-plugin-coder/src/components/CoderAuthFormDialog/CoderAuthFormDialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import DialogContent from '@material-ui/core/DialogContent';
77
import DialogTitle from '@material-ui/core/DialogTitle';
88
import DialogActions from '@material-ui/core/DialogActions';
99
import { CoderAuthForm } from '../CoderAuthForm/CoderAuthForm';
10+
import { scaleCssUnit } from '../../utils/styling';
1011

1112
const useStyles = makeStyles(theme => ({
1213
trigger: {
@@ -41,7 +42,7 @@ const useStyles = makeStyles(theme => ({
4142
},
4243

4344
dialogTitle: {
44-
fontSize: theme.typography.h5.fontSize ?? '24px',
45+
fontSize: scaleCssUnit(theme.typography.body1.fontSize, 1.5),
4546
borderBottom: `${theme.palette.divider} 1px solid`,
4647
padding: `${theme.spacing(1)}px ${theme.spacing(3)}px`,
4748
},

plugins/backstage-plugin-coder/src/components/CoderWorkspacesCard/HeaderRow.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { HTMLAttributes, ReactNode } from 'react';
22
import { type Theme, makeStyles } from '@material-ui/core';
33
import { useWorkspacesCardContext } from './Root';
44
import type { HtmlHeader } from '../../typesConstants';
5+
import { scaleCssUnit } from '../../utils/styling';
56

67
type StyleKey = 'root' | 'header' | 'hgroup' | 'subheader';
78
const useStyles = makeStyles<Theme, {}, StyleKey>(theme => ({
@@ -18,17 +19,16 @@ const useStyles = makeStyles<Theme, {}, StyleKey>(theme => ({
1819
},
1920

2021
header: {
21-
// Want the header text to be set solid (typography term for setting line
22-
// height equal to font size) to reduce gaps between it and the subtitle,
23-
// but only MUI's h3 line height is the smallest value/closest match
24-
lineHeight: theme.typography.h3.lineHeight ?? 1,
25-
fontSize: theme.typography.h5.fontSize ?? '1.5rem',
22+
// Setting line height solid (when leading and font size are equal) to make
23+
// it easier for header and subtitle to sit next to each other
24+
lineHeight: 1,
25+
fontSize: scaleCssUnit(theme.typography.body1.fontSize, 1.5),
2626
margin: 0,
2727
},
2828

2929
subheader: {
3030
margin: '0',
31-
fontSize: theme.typography.subtitle2.fontSize ?? '0.875rem',
31+
fontSize: scaleCssUnit(theme.typography.body1.fontSize, 0.875),
3232
fontWeight: 400,
3333
color: theme.palette.text.secondary,
3434
paddingTop: theme.spacing(0.5),

0 commit comments

Comments
 (0)