refactor: Inline workspace badge (#4774)

This commit is contained in:
Bruno Quaresma
2022-10-26 16:30:02 -03:00
committed by GitHub
parent 896f628473
commit d88b824328
4 changed files with 14 additions and 11 deletions

View File

@ -62,6 +62,7 @@ const useStyles = makeStyles((theme) => ({
title: { title: {
fontSize: theme.spacing(3), fontSize: theme.spacing(3),
fontWeight: 400,
margin: 0, margin: 0,
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",

View File

@ -39,6 +39,7 @@ const useStyles = makeStyles<Theme, PillProps>((theme) => ({
icon ? theme.spacing(0.75) : theme.spacing(1.5), icon ? theme.spacing(0.75) : theme.spacing(1.5),
paddingRight: theme.spacing(1.5), paddingRight: theme.spacing(1.5),
whiteSpace: "nowrap", whiteSpace: "nowrap",
fontWeight: 400,
}, },
pillColor: { pillColor: {
@ -54,16 +55,16 @@ const useStyles = makeStyles<Theme, PillProps>((theme) => ({
iconWrapper: { iconWrapper: {
marginRight: theme.spacing(0.5), marginRight: theme.spacing(0.5),
width: theme.spacing(2), width: theme.spacing(1.75),
height: theme.spacing(2), height: theme.spacing(1.75),
lineHeight: 0, lineHeight: 0,
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "center",
"& > svg": { "& > svg": {
width: theme.spacing(2), width: theme.spacing(1.75),
height: theme.spacing(2), height: theme.spacing(1.75),
}, },
}, },
})) }))

View File

@ -155,10 +155,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
</Stack> </Stack>
} }
> >
<WorkspaceStatusBadge
build={workspace.latest_build}
className={styles.statusBadge}
/>
<Stack direction="row" spacing={3} alignItems="center"> <Stack direction="row" spacing={3} alignItems="center">
{hasTemplateIcon && ( {hasTemplateIcon && (
<img <img
@ -168,7 +164,13 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
/> />
)} )}
<div> <div>
<PageHeaderTitle>{workspace.name}</PageHeaderTitle> <PageHeaderTitle>
{workspace.name}
<WorkspaceStatusBadge
build={workspace.latest_build}
className={styles.statusBadge}
/>
</PageHeaderTitle>
<PageHeaderSubtitle condensed> <PageHeaderSubtitle condensed>
{workspace.owner_name} {workspace.owner_name}
</PageHeaderSubtitle> </PageHeaderSubtitle>
@ -241,7 +243,7 @@ const spacerWidth = 300
export const useStyles = makeStyles((theme) => { export const useStyles = makeStyles((theme) => {
return { return {
statusBadge: { statusBadge: {
marginBottom: theme.spacing(3), marginLeft: theme.spacing(2),
}, },
actions: { actions: {

View File

@ -88,7 +88,6 @@ export const getStatus = (
icon: <LoadingIcon />, icon: <LoadingIcon />,
} }
} }
throw new Error("unknown text " + status)
} }
export type WorkspaceStatusBadgeProps = { export type WorkspaceStatusBadgeProps = {