diff --git a/.changeset/strong-peaches-melt.md b/.changeset/strong-peaches-melt.md new file mode 100644 index 0000000000..d866b8ba54 --- /dev/null +++ b/.changeset/strong-peaches-melt.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-components': patch +--- + +Sync components in @backstage/core-components with the Component Design Guidelines diff --git a/packages/core-components/src/components/AlertDisplay/AlertDisplay.tsx b/packages/core-components/src/components/AlertDisplay/AlertDisplay.tsx index c1f8f51db0..83c11647bb 100644 --- a/packages/core-components/src/components/AlertDisplay/AlertDisplay.tsx +++ b/packages/core-components/src/components/AlertDisplay/AlertDisplay.tsx @@ -13,14 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React, { useEffect, useState } from 'react'; -import Snackbar from '@material-ui/core/Snackbar'; +import { alertApiRef, AlertMessage, useApi } from '@backstage/core-plugin-api'; import IconButton from '@material-ui/core/IconButton'; +import Snackbar from '@material-ui/core/Snackbar'; +import Typography from '@material-ui/core/Typography'; import CloseIcon from '@material-ui/icons/Close'; import { Alert } from '@material-ui/lab'; -import { AlertMessage, useApi, alertApiRef } from '@backstage/core-plugin-api'; import pluralize from 'pluralize'; +import React, { useEffect, useState } from 'react'; + +// TODO: improve on this and promote to a shared component for use by all apps. + +/** @public */ +export type AlertDisplayProps = { + anchorOrigin?: { + vertical: 'top' | 'bottom'; + horizontal: 'left' | 'center' | 'right'; + }; +}; /** * Displays alerts from {@link @backstage/core-plugin-api#AlertApi} @@ -30,17 +40,6 @@ import pluralize from 'pluralize'; * * Shown as SnackBar at the center top of the page by default. Configurable with props. */ - -// TODO: improve on this and promote to a shared component for use by all apps. - -export type AlertDisplayProps = { - anchorOrigin?: { - vertical: 'top' | 'bottom'; - horizontal: 'left' | 'center' | 'right'; - }; -}; - -/** @public */ export function AlertDisplay(props: AlertDisplayProps) { const [messages, setMessages] = useState>([]); const alertApi = useApi(alertApiRef); @@ -82,7 +81,7 @@ export function AlertDisplay(props: AlertDisplayProps) { } severity={firstMessage.severity} > - + {String(firstMessage.message)} {messages.length > 1 && ( {` (${messages.length - 1} older ${pluralize( @@ -90,7 +89,7 @@ export function AlertDisplay(props: AlertDisplayProps) { messages.length - 1, )})`} )} - + ); diff --git a/packages/core-components/src/components/Avatar/Avatar.tsx b/packages/core-components/src/components/Avatar/Avatar.tsx index af8dabf554..950f57668e 100644 --- a/packages/core-components/src/components/Avatar/Avatar.tsx +++ b/packages/core-components/src/components/Avatar/Avatar.tsx @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React, { CSSProperties } from 'react'; -import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'; import MaterialAvatar from '@material-ui/core/Avatar'; +import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'; +import Typography from '@material-ui/core/Typography'; +import React, { CSSProperties } from 'react'; + import { extractInitials, stringToColor } from './utils'; /** @public */ @@ -28,6 +30,8 @@ const useStyles = makeStyles( width: '4rem', height: '4rem', color: '#fff', + }, + avatarText: { fontWeight: theme.typography.fontWeightBold, letterSpacing: '1px', textTransform: 'uppercase', @@ -68,6 +72,11 @@ export function Avatar(props: AvatarProps) { const { displayName, picture, customStyles } = props; const classes = useStyles(); let styles = { ...customStyles }; + const fontStyles = { + fontFamily: styles.fontFamily, + fontSize: styles.fontSize, + fontWeight: styles.fontWeight, + }; // We only calculate the background color if there's not an avatar // picture. If there is a picture, it might have a transparent // background and we don't know whether the calculated background @@ -85,7 +94,16 @@ export function Avatar(props: AvatarProps) { className={classes.avatar} style={styles} > - {displayName && extractInitials(displayName)} + {displayName && ( + + {extractInitials(displayName)} + + )} ); } diff --git a/packages/core-components/src/components/CodeSnippet/CodeSnippet.tsx b/packages/core-components/src/components/CodeSnippet/CodeSnippet.tsx index fd83797a88..cd6ad07a5c 100644 --- a/packages/core-components/src/components/CodeSnippet/CodeSnippet.tsx +++ b/packages/core-components/src/components/CodeSnippet/CodeSnippet.tsx @@ -13,16 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React from 'react'; -import { useTheme } from '@material-ui/core/styles'; import { BackstageTheme } from '@backstage/theme'; -import { CopyTextButton } from '../CopyTextButton'; -import type {} from 'react-syntax-highlighter'; -import { default as LightAsync } from 'react-syntax-highlighter/dist/esm/light-async'; +import Box from '@material-ui/core/Box'; +import { useTheme } from '@material-ui/core/styles'; +import React from 'react'; +import LightAsync from 'react-syntax-highlighter/dist/esm/light-async'; import dark from 'react-syntax-highlighter/dist/esm/styles/hljs/dark'; import docco from 'react-syntax-highlighter/dist/esm/styles/hljs/docco'; +import { CopyTextButton } from '../CopyTextButton'; + +import type {} from 'react-syntax-highlighter'; /** * Properties for {@link CodeSnippet} * @@ -87,7 +88,7 @@ export function CodeSnippet(props: CodeSnippetProps) { const highlightColor = theme.palette.type === 'dark' ? '#256bf3' : '#e6ffed'; return ( -
+ {showCopyCodeButton && ( -
+ -
+
)} -
+ ); } diff --git a/packages/core-components/src/components/DismissableBanner/DismissableBanner.tsx b/packages/core-components/src/components/DismissableBanner/DismissableBanner.tsx index 99113fcdb1..c18f9b605f 100644 --- a/packages/core-components/src/components/DismissableBanner/DismissableBanner.tsx +++ b/packages/core-components/src/components/DismissableBanner/DismissableBanner.tsx @@ -58,7 +58,7 @@ const useStyles = makeStyles( zIndex: 'unset', }, icon: { - fontSize: 20, + fontSize: theme.typography.h6.fontSize, }, content: { width: '100%', diff --git a/packages/core-components/src/components/EmptyState/MissingAnnotationEmptyState.tsx b/packages/core-components/src/components/EmptyState/MissingAnnotationEmptyState.tsx index 59596e6d2b..1910d6e7fd 100644 --- a/packages/core-components/src/components/EmptyState/MissingAnnotationEmptyState.tsx +++ b/packages/core-components/src/components/EmptyState/MissingAnnotationEmptyState.tsx @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; -import Button from '@material-ui/core/Button'; -import Typography from '@material-ui/core/Typography'; import { BackstageTheme } from '@backstage/theme'; +import Box from '@material-ui/core/Box'; +import Button from '@material-ui/core/Button'; +import { makeStyles } from '@material-ui/core/styles'; +import Typography from '@material-ui/core/Typography'; +import React from 'react'; + +import { CodeSnippet } from '../CodeSnippet'; import { Link } from '../Link'; import { EmptyState } from './EmptyState'; -import { CodeSnippet } from '../CodeSnippet'; const COMPONENT_YAML_TEMPLATE = `apiVersion: backstage.io/v1alpha1 kind: Component @@ -109,7 +110,7 @@ export function MissingAnnotationEmptyState(props: Props) { Add the annotation to your component YAML as shown in the highlighted example below: -
+ -
+ diff --git a/packages/core-components/src/components/FeatureDiscovery/FeatureCalloutCircular.tsx b/packages/core-components/src/components/FeatureDiscovery/FeatureCalloutCircular.tsx index cac3c8166b..b967ee0a9f 100644 --- a/packages/core-components/src/components/FeatureDiscovery/FeatureCalloutCircular.tsx +++ b/packages/core-components/src/components/FeatureDiscovery/FeatureCalloutCircular.tsx @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import Box from '@material-ui/core/Box'; import ClickAwayListener from '@material-ui/core/ClickAwayListener'; import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; @@ -26,6 +26,7 @@ import React, { useState, } from 'react'; import { createPortal } from 'react-dom'; + import { usePortal } from './lib/usePortal'; import { useShowCallout } from './lib/useShowCallout'; @@ -168,14 +169,14 @@ export function FeatureCalloutCircular(props: PropsWithChildren) { return ( <> -
+ {children} -
+ {createPortal( -
+ <> -
) { role="button" tabIndex={0} > -
-
-
+ + ) { {title} {description} -
+ -
, +
, portalElement, )} diff --git a/packages/core-components/src/components/HeaderIconLinkRow/IconLinkVertical.tsx b/packages/core-components/src/components/HeaderIconLinkRow/IconLinkVertical.tsx index f128455549..df03c0f3c6 100644 --- a/packages/core-components/src/components/HeaderIconLinkRow/IconLinkVertical.tsx +++ b/packages/core-components/src/components/HeaderIconLinkRow/IconLinkVertical.tsx @@ -18,6 +18,8 @@ import classnames from 'classnames'; import { makeStyles } from '@material-ui/core/styles'; import LinkIcon from '@material-ui/icons/Link'; import { Link } from '../Link'; +import Box from '@material-ui/core/Box'; +import Typography from '@material-ui/core/Typography'; export type IconLinkVerticalProps = { color?: 'primary' | 'secondary'; @@ -56,9 +58,8 @@ const useIconStyles = makeStyles( color: theme.palette.secondary.main, }, label: { - fontSize: '0.7rem', textTransform: 'uppercase', - fontWeight: 600, + fontWeight: theme.typography.fontWeightBold, letterSpacing: 1.2, }, }), @@ -79,10 +80,12 @@ export function IconLinkVertical({ if (disabled) { return ( -
+ {icon} - {label} -
+ + {label} + + ); } @@ -94,7 +97,9 @@ export function IconLinkVertical({ onClick={onClick} > {icon} - {label} + + {label} + ); } diff --git a/packages/core-components/src/components/HorizontalScrollGrid/HorizontalScrollGrid.tsx b/packages/core-components/src/components/HorizontalScrollGrid/HorizontalScrollGrid.tsx index 4ab49596fe..c4c9dadb78 100644 --- a/packages/core-components/src/components/HorizontalScrollGrid/HorizontalScrollGrid.tsx +++ b/packages/core-components/src/components/HorizontalScrollGrid/HorizontalScrollGrid.tsx @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import Box from '@material-ui/core/Box'; import Grid from '@material-ui/core/Grid'; import IconButton from '@material-ui/core/IconButton'; import { makeStyles, Theme } from '@material-ui/core/styles'; @@ -227,7 +227,7 @@ export function HorizontalScrollGrid(props: PropsWithChildren) { }; return ( -
+ ) { > {children} -
-
) { )} -
+ ); } diff --git a/packages/core-components/src/components/Lifecycle/Lifecycle.tsx b/packages/core-components/src/components/Lifecycle/Lifecycle.tsx index f553129927..f0bbeaa7bd 100644 --- a/packages/core-components/src/components/Lifecycle/Lifecycle.tsx +++ b/packages/core-components/src/components/Lifecycle/Lifecycle.tsx @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React from 'react'; -import CSS from 'csstype'; import { makeStyles } from '@material-ui/core/styles'; +import Typography from '@material-ui/core/Typography'; +import CSS from 'csstype'; +import React from 'react'; type Props = CSS.Properties & { shorthand?: boolean; @@ -47,15 +47,16 @@ export function Lifecycle(props: Props) { const classes = useStyles(props); const { shorthand, alpha } = props; return shorthand ? ( - {alpha ? <>α : <>β} - + ) : ( - + {alpha ? 'Alpha' : 'Beta'} - + ); } diff --git a/packages/core-components/src/components/Link/Link.tsx b/packages/core-components/src/components/Link/Link.tsx index dfa38be44e..440fcb811f 100644 --- a/packages/core-components/src/components/Link/Link.tsx +++ b/packages/core-components/src/components/Link/Link.tsx @@ -13,21 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import { configApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api'; -import classnames from 'classnames'; // eslint-disable-next-line no-restricted-imports import MaterialLink, { LinkProps as MaterialLinkProps, } from '@material-ui/core/Link'; import { makeStyles } from '@material-ui/core/styles'; +import Typography from '@material-ui/core/Typography'; +import classnames from 'classnames'; +import { trimEnd } from 'lodash'; import React, { ElementType } from 'react'; import { + createRoutesFromChildren, Link as RouterLink, LinkProps as RouterLinkProps, + Route, } from 'react-router-dom'; -import { trimEnd } from 'lodash'; -import { createRoutesFromChildren, Route } from 'react-router-dom'; export function isReactRouterBeta(): boolean { const [obj] = createRoutesFromChildren(} />); @@ -161,7 +162,9 @@ export const Link = React.forwardRef( className={classnames(classes.externalLink, props.className)} > {props.children} - , Opens in a new window + + , Opens in a new window + ) : ( // Interact with React Router for internal links diff --git a/packages/core-components/src/components/LogViewer/RealLogViewer.tsx b/packages/core-components/src/components/LogViewer/RealLogViewer.tsx index ac66d7cdf5..59e0bea44b 100644 --- a/packages/core-components/src/components/LogViewer/RealLogViewer.tsx +++ b/packages/core-components/src/components/LogViewer/RealLogViewer.tsx @@ -13,18 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React, { useEffect, useMemo, useRef } from 'react'; -import { useLocation } from 'react-router-dom'; +import Box from '@material-ui/core/Box'; import IconButton from '@material-ui/core/IconButton'; import CopyIcon from '@material-ui/icons/FileCopy'; +import classnames from 'classnames'; +import React, { useEffect, useMemo, useRef } from 'react'; +import { useLocation } from 'react-router-dom'; import AutoSizer from 'react-virtualized-auto-sizer'; import { FixedSizeList } from 'react-window'; + import { AnsiProcessor } from './AnsiProcessor'; -import { HEADER_SIZE, useStyles } from './styles'; -import classnames from 'classnames'; import { LogLine } from './LogLine'; import { LogViewerControls } from './LogViewerControls'; +import { HEADER_SIZE, useStyles } from './styles'; import { useLogViewerSearch } from './useLogViewerSearch'; import { useLogViewerSelection } from './useLogViewerSelection'; @@ -69,10 +70,10 @@ export function RealLogViewer(props: RealLogViewerProps) { return ( {({ height, width }) => ( -
-
+ + -
+ -
+ ); }} -
+
)} ); diff --git a/packages/core-components/src/components/Progress/Progress.tsx b/packages/core-components/src/components/Progress/Progress.tsx index f199c5640f..eb17b9eb25 100644 --- a/packages/core-components/src/components/Progress/Progress.tsx +++ b/packages/core-components/src/components/Progress/Progress.tsx @@ -13,23 +13,29 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React, { useState, useEffect, PropsWithChildren } from 'react'; +import { BackstageTheme } from '@backstage/theme'; +import Box from '@material-ui/core/Box'; import LinearProgress, { LinearProgressProps, } from '@material-ui/core/LinearProgress'; +import { useTheme } from '@material-ui/core/styles'; +import React, { PropsWithChildren, useEffect, useState } from 'react'; export function Progress(props: PropsWithChildren) { + const theme = useTheme(); const [isVisible, setIsVisible] = useState(false); useEffect(() => { - const handle = setTimeout(() => setIsVisible(true), 250); + const handle = setTimeout( + () => setIsVisible(true), + theme.transitions.duration.short, + ); return () => clearTimeout(handle); - }, []); + }, [theme.transitions.duration.short]); return isVisible ? ( ) : ( -
+ ); } diff --git a/packages/core-components/src/components/ProgressBars/Gauge.tsx b/packages/core-components/src/components/ProgressBars/Gauge.tsx index 11f977b387..ca84a5f480 100644 --- a/packages/core-components/src/components/ProgressBars/Gauge.tsx +++ b/packages/core-components/src/components/ProgressBars/Gauge.tsx @@ -18,6 +18,7 @@ import { BackstagePalette, BackstageTheme } from '@backstage/theme'; import { makeStyles, useTheme } from '@material-ui/core/styles'; import { Circle } from 'rc-progress'; import React, { ReactNode, useEffect, useState } from 'react'; +import Box from '@material-ui/core/Box'; /** @public */ export type GaugeClassKey = @@ -38,8 +39,8 @@ const useStyles = makeStyles( top: '50%', left: '50%', transform: 'translate(-50%, -60%)', - fontSize: 45, - fontWeight: 'bold', + fontSize: theme.typography.pxToRem(45), + fontWeight: theme.typography.fontWeightBold, color: theme.palette.textContrast, }, description: { @@ -152,7 +153,7 @@ export function Gauge(props: GaugeProps) { }, [description, hoverRef]); return ( -
+ {description && isHovering ? ( -
{description}
+ {description} ) : ( -
+ {isNaN(value) ? 'N/A' : `${asActual}${unit}`} -
+
)} -
+
); } diff --git a/packages/core-components/src/components/ProgressBars/GaugeCard.tsx b/packages/core-components/src/components/ProgressBars/GaugeCard.tsx index 1114890523..3442395380 100644 --- a/packages/core-components/src/components/ProgressBars/GaugeCard.tsx +++ b/packages/core-components/src/components/ProgressBars/GaugeCard.tsx @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import Box from '@material-ui/core/Box'; import { makeStyles } from '@material-ui/core/styles'; import React, { ReactNode } from 'react'; + import { BottomLinkProps } from '../../layout/BottomLink'; import { InfoCard, InfoCardVariants } from '../../layout/InfoCard'; import { Gauge, GaugePropsGetColor } from './Gauge'; @@ -74,7 +75,7 @@ export function GaugeCard(props: Props) { }; return ( -
+ -
+ ); } diff --git a/packages/core-components/src/components/ProgressBars/LinearGauge.tsx b/packages/core-components/src/components/ProgressBars/LinearGauge.tsx index 643c3ec2ac..5bfe1b7a61 100644 --- a/packages/core-components/src/components/ProgressBars/LinearGauge.tsx +++ b/packages/core-components/src/components/ProgressBars/LinearGauge.tsx @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React from 'react'; +import { BackstageTheme } from '@backstage/theme'; import { useTheme } from '@material-ui/core/styles'; import Tooltip from '@material-ui/core/Tooltip'; +import Typography from '@material-ui/core/Typography'; import { Line } from 'rc-progress'; -import { BackstageTheme } from '@backstage/theme'; -import { getProgressColor, GaugePropsGetColor } from './Gauge'; +import React from 'react'; + +import { GaugePropsGetColor, getProgressColor } from './Gauge'; type Props = { /** @@ -47,14 +48,14 @@ export function LinearGauge(props: Props) { }); return ( - + - + ); } diff --git a/packages/core-components/src/components/Select/Select.tsx b/packages/core-components/src/components/Select/Select.tsx index 7229f89653..9cb8822a05 100644 --- a/packages/core-components/src/components/Select/Select.tsx +++ b/packages/core-components/src/components/Select/Select.tsx @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import Box from '@material-ui/core/Box'; import Checkbox from '@material-ui/core/Checkbox'; import Chip from '@material-ui/core/Chip'; import ClickAwayListener from '@material-ui/core/ClickAwayListener'; @@ -30,6 +30,7 @@ import { } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import React, { useEffect, useState } from 'react'; + import ClosedDropdown from './static/ClosedDropdown'; import OpenedDropdown from './static/OpenedDropdown'; @@ -45,17 +46,17 @@ const BootstrapInput = withStyles( }, }, input: { - borderRadius: 4, + borderRadius: theme.shape.borderRadius, position: 'relative', backgroundColor: theme.palette.background.paper, border: '1px solid #ced4da', - fontSize: 16, - padding: '10px 26px 10px 12px', + fontSize: theme.typography.body1.fontSize, + padding: theme.spacing(1.25, 3.25, 1.25, 1.5), transition: theme.transitions.create(['border-color', 'box-shadow']), fontFamily: 'Helvetica Neue', '&:focus': { background: theme.palette.background.paper, - borderRadius: 4, + borderRadius: theme.shape.borderRadius, }, }, }), @@ -81,7 +82,7 @@ const useStyles = makeStyles( label: { transform: 'initial', fontWeight: 'bold', - fontSize: 14, + fontSize: theme.typography.body2.fontSize, fontFamily: theme.typography.fontFamily, color: theme.palette.text.primary, '&.Mui-focused': { @@ -91,7 +92,7 @@ const useStyles = makeStyles( formLabel: { transform: 'initial', fontWeight: 'bold', - fontSize: 14, + fontSize: theme.typography.body2.fontSize, fontFamily: theme.typography.fontFamily, color: theme.palette.text.primary, '&.Mui-focused': { @@ -196,7 +197,7 @@ export function SelectComponent(props: SelectProps) { }; return ( -
+ {label} @@ -217,7 +218,7 @@ export function SelectComponent(props: SelectProps) { tabIndex={0} renderValue={s => multiple && (value as any[]).length !== 0 ? ( -
+ {(s as string[]).map(selectedValue => ( el.value === selectedValue)?.value} @@ -229,7 +230,7 @@ export function SelectComponent(props: SelectProps) { className={classes.chip} /> ))} -
+
) : ( {(value as any[]).length === 0 @@ -279,6 +280,6 @@ export function SelectComponent(props: SelectProps) { -
+ ); } diff --git a/packages/core-components/src/components/Select/static/ClosedDropdown.tsx b/packages/core-components/src/components/Select/static/ClosedDropdown.tsx index 7b0516d017..812afe34eb 100644 --- a/packages/core-components/src/components/Select/static/ClosedDropdown.tsx +++ b/packages/core-components/src/components/Select/static/ClosedDropdown.tsx @@ -21,11 +21,11 @@ import SvgIcon from '@material-ui/core/SvgIcon'; export type ClosedDropdownClassKey = 'icon'; const useStyles = makeStyles( - () => + theme => createStyles({ icon: { position: 'absolute', - right: '4px', + right: theme.spacing(0.5), pointerEvents: 'none', }, }), diff --git a/packages/core-components/src/components/Select/static/OpenedDropdown.tsx b/packages/core-components/src/components/Select/static/OpenedDropdown.tsx index 617288ded6..b87a00c26a 100644 --- a/packages/core-components/src/components/Select/static/OpenedDropdown.tsx +++ b/packages/core-components/src/components/Select/static/OpenedDropdown.tsx @@ -20,11 +20,11 @@ import SvgIcon from '@material-ui/core/SvgIcon'; export type OpenedDropdownClassKey = 'icon'; const useStyles = makeStyles( - () => + theme => createStyles({ icon: { position: 'absolute', - right: '4px', + right: theme.spacing(0.5), pointerEvents: 'none', }, }), diff --git a/packages/core-components/src/components/SimpleStepper/SimpleStepperFooter.tsx b/packages/core-components/src/components/SimpleStepper/SimpleStepperFooter.tsx index 0f7d604eb0..224b66533a 100644 --- a/packages/core-components/src/components/SimpleStepper/SimpleStepperFooter.tsx +++ b/packages/core-components/src/components/SimpleStepper/SimpleStepperFooter.tsx @@ -13,11 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React, { useContext, ReactNode, PropsWithChildren } from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import Box from '@material-ui/core/Box'; import Button from '@material-ui/core/Button'; -import { StepActions } from './types'; +import { makeStyles } from '@material-ui/core/styles'; +import React, { PropsWithChildren, ReactNode, useContext } from 'react'; + import { VerticalStepperContext } from './SimpleStepper'; +import { StepActions } from './types'; export type SimpleStepperFooterClassKey = 'root'; @@ -145,7 +147,7 @@ export const SimpleStepperFooter = ({ }; return ( -
+ {[undefined, true].includes(actions.showBack) && stepIndex !== 0 && ( )} {children} -
+ ); }; diff --git a/packages/core-components/src/components/SimpleStepper/SimpleStepperStep.tsx b/packages/core-components/src/components/SimpleStepper/SimpleStepperStep.tsx index bb46163105..911ad2e73e 100644 --- a/packages/core-components/src/components/SimpleStepper/SimpleStepperStep.tsx +++ b/packages/core-components/src/components/SimpleStepper/SimpleStepperStep.tsx @@ -13,12 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React, { PropsWithChildren } from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import Box from '@material-ui/core/Box'; import MuiStep from '@material-ui/core/Step'; import StepContent from '@material-ui/core/StepContent'; import StepLabel from '@material-ui/core/StepLabel'; +import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; +import React, { PropsWithChildren } from 'react'; + import { SimpleStepperFooter } from './SimpleStepperFooter'; import { StepProps } from './types'; @@ -40,11 +42,11 @@ export function SimpleStepperStep(props: PropsWithChildren) { // The end step is not a part of the stepper // It simply is the final screen with an option to have buttons such as reset or back return end ? ( -
+ {title} {children} -
+ ) : ( diff --git a/packages/core-components/src/components/Status/Status.tsx b/packages/core-components/src/components/Status/Status.tsx index a855fe3ebe..364193e383 100644 --- a/packages/core-components/src/components/Status/Status.tsx +++ b/packages/core-components/src/components/Status/Status.tsx @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import { makeStyles } from '@material-ui/core/styles'; import { BackstageTheme } from '@backstage/theme'; +import { makeStyles } from '@material-ui/core/styles'; +import Typography from '@material-ui/core/Typography'; import classNames from 'classnames'; import React, { PropsWithChildren } from 'react'; @@ -31,12 +31,12 @@ export type StatusClassKey = const useStyles = makeStyles( theme => ({ status: { - fontWeight: 500, + fontWeight: theme.typography.fontWeightMedium, '&::before': { width: '0.7em', height: '0.7em', display: 'inline-block', - marginRight: 8, + marginRight: theme.spacing(1), borderRadius: '50%', content: '""', }, @@ -78,7 +78,8 @@ const useStyles = makeStyles( export function StatusOK(props: PropsWithChildren<{}>) { const classes = useStyles(props); return ( -