fix: moved button and label to TitleSection and added status icon

This commit is contained in:
Jose Sousa 2020-11-27 16:01:59 +00:00 committed by Josh Harvey
parent 9d52b49083
commit 6b569a89c2
4 changed files with 48 additions and 49 deletions

View file

@ -4,13 +4,21 @@ import React from 'react'
import ErrorMessage from 'src/components/ErrorMessage'
import Title from 'src/components/Title'
import { SubpageButton } from 'src/components/buttons'
import { Label1 } from 'src/components/typography'
import styles from './TitleSection.styles'
const useStyles = makeStyles(styles)
const TitleSection = ({ className, title, error, labels, children }) => {
const TitleSection = ({
className,
title,
error,
labels,
button,
children
}) => {
const classes = useStyles()
return (
<div className={classnames(classes.titleWrapper, className)}>
@ -19,6 +27,15 @@ const TitleSection = ({ className, title, error, labels, children }) => {
{error && (
<ErrorMessage className={classes.error}>Failed to save</ErrorMessage>
)}
{button && (
<SubpageButton
className={classes.subpageButton}
Icon={button.icon}
InverseIcon={button.inverseIcon}
toggle={button.toggle}>
{button.text}
</SubpageButton>
)}
</div>
<Box display="flex" flexDirection="row">
{(labels ?? []).map(({ icon, label }, idx) => (