diff --git a/packages/core-components/src/layout/BottomLink/BottomLink.tsx b/packages/core-components/src/layout/BottomLink/BottomLink.tsx index c9c1659284..f385d9ce11 100644 --- a/packages/core-components/src/layout/BottomLink/BottomLink.tsx +++ b/packages/core-components/src/layout/BottomLink/BottomLink.tsx @@ -61,7 +61,7 @@ export function BottomLink(props: BottomLinkProps) { const classes = useStyles(); return ( -
+ @@ -73,6 +73,6 @@ export function BottomLink(props: BottomLinkProps) { -
+ ); } diff --git a/packages/core-components/src/layout/ContentHeader/ContentHeader.tsx b/packages/core-components/src/layout/ContentHeader/ContentHeader.tsx index 5a9ed3a77e..381919a170 100644 --- a/packages/core-components/src/layout/ContentHeader/ContentHeader.tsx +++ b/packages/core-components/src/layout/ContentHeader/ContentHeader.tsx @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * TODO favoriteable capability - */ - +import Box from '@material-ui/core/Box'; import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import React, { PropsWithChildren, ReactNode } from 'react'; import { Helmet } from 'react-helmet'; +/** + * TODO: favoriteable capability + */ + /** @public */ export type ContentHeaderClassKey = | 'container' @@ -120,17 +120,17 @@ export function ContentHeader(props: PropsWithChildren) { return ( <> -
-
+ + {renderedTitle} {description && ( {description} )} -
-
{children}
-
+ + {children} + ); } diff --git a/packages/core-components/src/layout/ErrorBoundary/ErrorBoundary.tsx b/packages/core-components/src/layout/ErrorBoundary/ErrorBoundary.tsx index 39ad82babd..da430d2f88 100644 --- a/packages/core-components/src/layout/ErrorBoundary/ErrorBoundary.tsx +++ b/packages/core-components/src/layout/ErrorBoundary/ErrorBoundary.tsx @@ -14,6 +14,7 @@ * limitations under the License. */ +import Typography from '@material-ui/core/Typography'; import React, { ComponentClass, Component, ErrorInfo } from 'react'; import { Button } from '../../components/Button'; import { ErrorPanel } from '../../components/ErrorPanel'; @@ -40,9 +41,11 @@ const SlackLink = (props: { slackChannel?: string | SlackChannel }) => { if (!slackChannel) { return null; } else if (typeof slackChannel === 'string') { - return <>Please contact {slackChannel} for help.; + return Please contact {slackChannel} for help.; } else if (!slackChannel.href) { - return <>Please contact {slackChannel.name} for help.; + return ( + Please contact {slackChannel.name} for help. + ); } return ( diff --git a/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.tsx b/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.tsx index e164244ea7..be6c0c6531 100644 --- a/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.tsx +++ b/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.tsx @@ -44,7 +44,7 @@ const ActionItem = ({ onClick, }: HeaderActionMenuItem) => { return ( - + {icon}} - + ); }; diff --git a/packages/core-components/src/layout/HeaderLabel/HeaderLabel.tsx b/packages/core-components/src/layout/HeaderLabel/HeaderLabel.tsx index f523a5319b..e3b6299f85 100644 --- a/packages/core-components/src/layout/HeaderLabel/HeaderLabel.tsx +++ b/packages/core-components/src/layout/HeaderLabel/HeaderLabel.tsx @@ -30,7 +30,7 @@ const useStyles = makeStyles( }, label: { color: theme.palette.common.white, - fontWeight: 'bold', + fontWeight: theme.typography.fontWeightBold, letterSpacing: 0, fontSize: theme.typography.fontSize, marginBottom: theme.spacing(1) / 2, @@ -77,10 +77,10 @@ export function HeaderLabel(props: HeaderLabelProps) { ); return ( - + {label} {url ? {content} : content} - + ); } diff --git a/packages/core-components/src/layout/HeaderTabs/HeaderTabs.tsx b/packages/core-components/src/layout/HeaderTabs/HeaderTabs.tsx index a97fc70e4b..aac062c01b 100644 --- a/packages/core-components/src/layout/HeaderTabs/HeaderTabs.tsx +++ b/packages/core-components/src/layout/HeaderTabs/HeaderTabs.tsx @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -// TODO(blam): Remove this implementation when the Tabs are ready -// This is just a temporary solution to implementing tabs for now - +import Box from '@material-ui/core/Box'; import { makeStyles } from '@material-ui/core/styles'; import TabUI, { TabProps } from '@material-ui/core/Tab'; import Tabs from '@material-ui/core/Tabs'; import React, { useCallback, useEffect, useState } from 'react'; +// TODO(blam): Remove this implementation when the Tabs are ready +// This is just a temporary solution to implementing tabs for now + /** @public */ export type HeaderTabsClassKey = | 'tabsWrapper' @@ -38,10 +38,10 @@ const useStyles = makeStyles( minWidth: 0, }, defaultTab: { - padding: theme.spacing(3, 3), ...theme.typography.caption, + padding: theme.spacing(3, 3), textTransform: 'uppercase', - fontWeight: 'bold', + fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.secondary, }, selected: { @@ -97,7 +97,7 @@ export function HeaderTabs(props: HeaderTabsProps) { }, [selectedIndex]); return ( -
+ ))} -
+ ); } diff --git a/packages/core-components/src/layout/InfoCard/InfoCard.tsx b/packages/core-components/src/layout/InfoCard/InfoCard.tsx index 831c8f95d9..2026a7eced 100644 --- a/packages/core-components/src/layout/InfoCard/InfoCard.tsx +++ b/packages/core-components/src/layout/InfoCard/InfoCard.tsx @@ -47,7 +47,7 @@ const useStyles = makeStyles( padding: theme.spacing(2, 2, 2, 2.5), }, headerTitle: { - fontWeight: 700, + fontWeight: theme.typography.fontWeightBold, }, headerSubheader: { paddingTop: theme.spacing(1), diff --git a/packages/core-components/src/layout/ItemCard/ItemCardGrid.tsx b/packages/core-components/src/layout/ItemCard/ItemCardGrid.tsx index 885b43ca34..a1e6d24aeb 100644 --- a/packages/core-components/src/layout/ItemCard/ItemCardGrid.tsx +++ b/packages/core-components/src/layout/ItemCard/ItemCardGrid.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 { createStyles, makeStyles, @@ -65,8 +65,8 @@ export function ItemCardGrid(props: ItemCardGridProps) { const { children, ...otherProps } = props; const classes = useStyles(otherProps); return ( -
+ {children} -
+ ); } diff --git a/packages/core-components/src/layout/ItemCard/ItemCardHeader.tsx b/packages/core-components/src/layout/ItemCard/ItemCardHeader.tsx index 76cf668079..da3d9b7ebe 100644 --- a/packages/core-components/src/layout/ItemCard/ItemCardHeader.tsx +++ b/packages/core-components/src/layout/ItemCard/ItemCardHeader.tsx @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import { BackstageTheme } from '@backstage/theme'; +import Box from '@material-ui/core/Box'; import { createStyles, makeStyles, WithStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import React from 'react'; -import { BackstageTheme } from '@backstage/theme'; /** @public */ export type ItemCardHeaderClassKey = 'root'; @@ -77,7 +77,7 @@ export function ItemCardHeader(props: ItemCardHeaderProps) { const { title, subtitle, children } = props; const classes = useStyles(props); return ( -
+ {subtitle && ( {subtitle} @@ -89,6 +89,6 @@ export function ItemCardHeader(props: ItemCardHeaderProps) { )} {children} -
+ ); } diff --git a/packages/core-components/src/layout/Sidebar/Bar.tsx b/packages/core-components/src/layout/Sidebar/Bar.tsx index c86f60a0a2..69b77dd5e1 100644 --- a/packages/core-components/src/layout/Sidebar/Bar.tsx +++ b/packages/core-components/src/layout/Sidebar/Bar.tsx @@ -13,28 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +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 useMediaQuery from '@material-ui/core/useMediaQuery'; import classnames from 'classnames'; - -import React, { useState, useContext, useRef } from 'react'; -import Button from '@material-ui/core/Button'; +import React, { useContext, useRef, useState } from 'react'; import { makeSidebarConfig, makeSidebarSubmenuConfig, SidebarConfig, SidebarConfigContext, - SubmenuConfig, SidebarOptions, + SubmenuConfig, SubmenuOptions, } from './config'; -import { BackstageTheme } from '@backstage/theme'; +import { MobileSidebar } from './MobileSidebar'; import { useContent } from './Page'; import { SidebarOpenStateProvider } from './SidebarOpenStateContext'; import { useSidebarPinState } from './SidebarPinStateContext'; -import { MobileSidebar } from './MobileSidebar'; /** @public */ export type SidebarClassKey = 'drawer' | 'drawerOpen'; @@ -191,7 +190,7 @@ const DesktopSidebar = (props: DesktopSidebarProps) => { ); diff --git a/packages/core-components/src/layout/Sidebar/Intro.tsx b/packages/core-components/src/layout/Sidebar/Intro.tsx index 5cc6bbdcd5..824e9e42fd 100644 --- a/packages/core-components/src/layout/Sidebar/Intro.tsx +++ b/packages/core-components/src/layout/Sidebar/Intro.tsx @@ -13,19 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import { BackstageTheme } from '@backstage/theme'; +import Box from '@material-ui/core/Box'; import Collapse from '@material-ui/core/Collapse'; -import { makeStyles } from '@material-ui/core/styles'; import IconButton from '@material-ui/core/IconButton'; +import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import CloseIcon from '@material-ui/icons/Close'; -import React, { useContext, useState } from 'react'; import { useLocalStorageValue } from '@react-hookz/web'; +import React, { useContext, useState } from 'react'; + import { - SidebarConfigContext, - SidebarConfig, SIDEBAR_INTRO_LOCAL_STORAGE, + SidebarConfig, + SidebarConfigContext, } from './config'; import { SidebarDivider } from './Items'; import { useSidebarOpenState } from './SidebarOpenStateContext'; @@ -45,8 +46,8 @@ const useStyles = makeStyles( // XXX (@koroeskohr): should I be using a Mui theme variable? fontSize: 12, width: props.sidebarConfig.drawerWidthOpen, - marginTop: 18, - marginBottom: 12, + marginTop: theme.spacing(2.25), + marginBottom: theme.spacing(1.5), paddingLeft: props.sidebarConfig.iconPadding, paddingRight: props.sidebarConfig.iconPadding, }), @@ -54,13 +55,13 @@ const useStyles = makeStyles( display: 'flex', justifyContent: 'flex-end', alignItems: 'center', - marginTop: 12, + marginTop: theme.spacing(1.5), }, introDismissLink: { color: '#dddddd', display: 'flex', alignItems: 'center', - marginBottom: 4, + marginBottom: theme.spacing(0.5), '&:hover': { color: theme.palette.linkHover, transition: theme.transitions.create('color', { @@ -78,7 +79,7 @@ const useStyles = makeStyles( introDismissIcon: { width: 18, height: 18, - marginRight: 12, + marginRight: theme.spacing(1.5), }, }), { name: 'BackstageSidebarIntro' }, @@ -103,17 +104,17 @@ export function IntroCard(props: IntroCardProps) { const handleClose = () => onClose(); return ( -
+ {text} -
+ Dismiss -
-
+ + ); } diff --git a/packages/core-components/src/layout/Sidebar/Items.tsx b/packages/core-components/src/layout/Sidebar/Items.tsx index fe8dede499..031b1e5168 100644 --- a/packages/core-components/src/layout/Sidebar/Items.tsx +++ b/packages/core-components/src/layout/Sidebar/Items.tsx @@ -13,23 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import { IconComponent, useElementFilter } from '@backstage/core-plugin-api'; import { BackstageTheme } from '@backstage/theme'; -import { makeStyles, styled, Theme } from '@material-ui/core/styles'; -import useMediaQuery from '@material-ui/core/useMediaQuery'; import Badge from '@material-ui/core/Badge'; -import TextField from '@material-ui/core/TextField'; -import Typography from '@material-ui/core/Typography'; +import Box from '@material-ui/core/Box'; +import { makeStyles, styled, Theme } from '@material-ui/core/styles'; import { CreateCSSProperties, StyledComponentProps, } from '@material-ui/core/styles/withStyles'; +import TextField from '@material-ui/core/TextField'; +import Typography from '@material-ui/core/Typography'; +import useMediaQuery from '@material-ui/core/useMediaQuery'; +import ArrowDropDown from '@material-ui/icons/ArrowDropDown'; +import ArrowDropUp from '@material-ui/icons/ArrowDropUp'; import ArrowRightIcon from '@material-ui/icons/ArrowRight'; import SearchIcon from '@material-ui/icons/Search'; -import ArrowDropUp from '@material-ui/icons/ArrowDropUp'; -import ArrowDropDown from '@material-ui/icons/ArrowDropDown'; import classnames from 'classnames'; +import { Location } from 'history'; import React, { ComponentProps, ComponentType, @@ -48,18 +49,18 @@ import { useLocation, useResolvedPath, } from 'react-router-dom'; + import { + SidebarConfig, SidebarConfigContext, SidebarItemWithSubmenuContext, - SidebarConfig, } from './config'; -import { SidebarSubmenuProps, SidebarSubmenu } from './SidebarSubmenu'; import DoubleArrowLeft from './icons/DoubleArrowLeft'; import DoubleArrowRight from './icons/DoubleArrowRight'; -import { isLocationMatch } from './utils'; -import { Location } from 'history'; import { useSidebarOpenState } from './SidebarOpenStateContext'; +import { SidebarSubmenu, SidebarSubmenuProps } from './SidebarSubmenu'; import { SidebarSubmenuItemProps } from './SidebarSubmenuItem'; +import { isLocationMatch } from './utils'; /** @public */ export type SidebarItemClassKey = @@ -145,7 +146,7 @@ const makeSidebarStyles = (sidebarConfig: SidebarConfig) => }, searchField: { color: '#b5b5b5', - fontWeight: 'bold', + fontWeight: theme.typography.fontWeightBold, fontSize: theme.typography.fontSize, }, searchFieldHTMLInput: { @@ -373,10 +374,10 @@ const SidebarItemBase = forwardRef((props, ref) => { !isOpen && hasSubmenu ? { display: 'flex', marginLeft: '24px' } : {}; const displayItemIcon = ( -
+ {!isOpen && hasSubmenu ? : <>} -
+ ); const itemIcon = ( @@ -393,9 +394,9 @@ const SidebarItemBase = forwardRef((props, ref) => { const openContent = ( <> -
+ {itemIcon} -
+ {text && ( {text} @@ -572,7 +573,7 @@ export function SidebarSearchField(props: SidebarSearchFieldProps) { }; return ( -
+ -
+ ); } @@ -620,13 +621,13 @@ export const SidebarSpacer = styled('div')( export type SidebarDividerClassKey = 'root'; export const SidebarDivider = styled('hr')( - { + ({ theme }) => ({ height: 1, width: '100%', background: '#383838', border: 'none', - margin: '12px 0px', - }, + margin: theme.spacing(1.2, 0), + }), { name: 'BackstageSidebarDivider' }, ) as ComponentType & StyledComponentProps<'root'>>; @@ -693,9 +694,9 @@ export const SidebarExpandButton = () => { aria-label="Expand Sidebar" data-testid="sidebar-expand-button" > -
+ {isOpen ? : } -
+ ); }; diff --git a/packages/core-components/src/layout/Sidebar/Page.tsx b/packages/core-components/src/layout/Sidebar/Page.tsx index bdf41b5dd7..5f660547d1 100644 --- a/packages/core-components/src/layout/Sidebar/Page.tsx +++ b/packages/core-components/src/layout/Sidebar/Page.tsx @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import { BackstageTheme } from '@backstage/theme'; +import Box from '@material-ui/core/Box'; import { makeStyles } from '@material-ui/core/styles'; - +import useMediaQuery from '@material-ui/core/useMediaQuery'; import React, { createContext, useCallback, @@ -25,10 +26,9 @@ import React, { useRef, useState, } from 'react'; -import { SidebarConfigContext, SidebarConfig } from './config'; -import { BackstageTheme } from '@backstage/theme'; + +import { SidebarConfig, SidebarConfigContext } from './config'; import { LocalStorage } from './localStorage'; -import useMediaQuery from '@material-ui/core/useMediaQuery'; import { SidebarPinStateProvider } from './SidebarPinStateContext'; export type SidebarPageClassKey = 'root'; @@ -122,7 +122,7 @@ export function SidebarPage(props: SidebarPageProps) { }} > -
{props.children}
+ {props.children}
); diff --git a/packages/core-components/src/layout/Sidebar/SidebarSubmenu.tsx b/packages/core-components/src/layout/Sidebar/SidebarSubmenu.tsx index 67fd026a91..cc61a6a063 100644 --- a/packages/core-components/src/layout/Sidebar/SidebarSubmenu.tsx +++ b/packages/core-components/src/layout/Sidebar/SidebarSubmenu.tsx @@ -13,17 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { BackstageTheme } from '@backstage/theme'; +import Box from '@material-ui/core/Box'; import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import classnames from 'classnames'; import React, { ReactNode, useContext, useEffect, useState } from 'react'; + import { - SidebarItemWithSubmenuContext, SidebarConfigContext, + SidebarItemWithSubmenuContext, SubmenuConfig, } from './config'; import { useSidebarOpenState } from './SidebarOpenStateContext'; -import { BackstageTheme } from '@backstage/theme'; const useStyles = makeStyles< BackstageTheme, @@ -77,9 +79,9 @@ const useStyles = makeStyles< }), title: { fontSize: theme.typography.h5.fontSize, - fontWeight: 500, + fontWeight: theme.typography.fontWeightMedium, color: '#FFF', - padding: 20, + padding: theme.spacing(2.5), [theme.breakpoints.down('xs')]: { display: 'none', }, @@ -120,7 +122,7 @@ export const SidebarSubmenu = (props: SidebarSubmenuProps) => { }, [isHoveredOn]); return ( -
{ {props.title} {props.children} -
+ ); }; diff --git a/packages/core-components/src/layout/Sidebar/SidebarSubmenuItem.tsx b/packages/core-components/src/layout/Sidebar/SidebarSubmenuItem.tsx index a97abb23bf..fbe4496c72 100644 --- a/packages/core-components/src/layout/Sidebar/SidebarSubmenuItem.tsx +++ b/packages/core-components/src/layout/Sidebar/SidebarSubmenuItem.tsx @@ -26,6 +26,7 @@ import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown'; import ArrowDropUpIcon from '@material-ui/icons/ArrowDropUp'; import { SidebarItemWithSubmenuContext } from './config'; import { isLocationMatch } from './utils'; +import Box from '@material-ui/core/Box'; const useStyles = makeStyles( theme => ({ @@ -39,7 +40,7 @@ const useStyles = makeStyles( display: 'flex', alignItems: 'center', color: theme.palette.navigation.color, - padding: 20, + padding: theme.spacing(2.5), cursor: 'pointer', position: 'relative', background: 'none', @@ -53,8 +54,8 @@ const useStyles = makeStyles( color: '#FFF', }, label: { - margin: 14, - marginLeft: 7, + margin: theme.spacing(1.75), + marginLeft: theme.spacing(1), fontSize: theme.typography.body2.fontSize, whiteSpace: 'nowrap', overflow: 'hidden', @@ -155,7 +156,7 @@ export const SidebarSubmenuItem = (props: SidebarSubmenuItemProps) => { return isActive; }); return ( -
+ {dropdownItems && showDropDown && ( -
+ {dropdownItems.map((object, key) => ( { ))} -
+
)} -
+ ); } return ( -
+ { -
+ ); }; diff --git a/packages/core-components/src/layout/Sidebar/icons/DoubleArrowLeft.tsx b/packages/core-components/src/layout/Sidebar/icons/DoubleArrowLeft.tsx index eb487940a8..ba1640a860 100644 --- a/packages/core-components/src/layout/Sidebar/icons/DoubleArrowLeft.tsx +++ b/packages/core-components/src/layout/Sidebar/icons/DoubleArrowLeft.tsx @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React from 'react'; +import Box from '@material-ui/core/Box'; import { makeStyles } from '@material-ui/core/styles'; import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos'; +import React from 'react'; const useStyles = makeStyles({ iconContainer: { @@ -34,14 +34,14 @@ const DoubleArrowLeft = () => { const classes = useStyles(); return ( -
-
+ + -
-
+ + -
-
+ + ); }; diff --git a/packages/core-components/src/layout/Sidebar/icons/DoubleArrowRight.tsx b/packages/core-components/src/layout/Sidebar/icons/DoubleArrowRight.tsx index e1e9b9476d..3824ec263d 100644 --- a/packages/core-components/src/layout/Sidebar/icons/DoubleArrowRight.tsx +++ b/packages/core-components/src/layout/Sidebar/icons/DoubleArrowRight.tsx @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React from 'react'; +import Box from '@material-ui/core/Box'; import { makeStyles } from '@material-ui/core/styles'; import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos'; +import React from 'react'; const useStyles = makeStyles({ iconContainer: { @@ -34,14 +34,14 @@ const DoubleArrowRight = () => { const classes = useStyles(); return ( -
-
+ + -
-
+ + -
-
+ + ); }; diff --git a/packages/core-components/src/layout/TabbedCard/TabbedCard.tsx b/packages/core-components/src/layout/TabbedCard/TabbedCard.tsx index b3b977f04b..90cc928169 100644 --- a/packages/core-components/src/layout/TabbedCard/TabbedCard.tsx +++ b/packages/core-components/src/layout/TabbedCard/TabbedCard.tsx @@ -96,7 +96,7 @@ export function TabbedCard(props: PropsWithChildren) { } else { React.Children.map(children, child => { if (React.isValidElement(child) && child?.props.value === value) { - selectedTabContent = child?.props.children; + selectedTabContent = child?.props?.children; } }); } @@ -142,7 +142,7 @@ const useCardTabStyles = makeStyles( }, }, selected: { - fontWeight: 'bold', + fontWeight: theme.typography.fontWeightBold, }, }), { name: 'BackstageCardTab' },