mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-27 13:49:10 +02:00
feat: allow icons in descriptions and add a placeholder
This commit is contained in:
parent
638914be22
commit
fb3f84a7d6
@ -24,7 +24,8 @@ interface ICreateProps {
|
|||||||
title?: ReactNode;
|
title?: ReactNode;
|
||||||
description: string;
|
description: string;
|
||||||
documentationLink: string;
|
documentationLink: string;
|
||||||
documentationLinkLabel: string;
|
documentationIcon?: ReactNode;
|
||||||
|
documentationLinkLabel?: string;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
modal?: boolean;
|
modal?: boolean;
|
||||||
disablePadding?: boolean;
|
disablePadding?: boolean;
|
||||||
@ -165,12 +166,20 @@ const StyledSidebar = styled('aside')(({ theme }) => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledDescription = styled('p')(({ theme }) => ({
|
const StyledDescriptionCard = styled('article')(({ theme }) => ({
|
||||||
color: theme.palette.common.white,
|
display: 'flex',
|
||||||
|
flexFlow: 'column nowrap',
|
||||||
|
gap: theme.spacing(2),
|
||||||
|
alignItems: 'center',
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
|
color: theme.palette.common.white,
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const StyledDescription = styled('p')(({ theme }) => ({
|
||||||
|
width: '100%',
|
||||||
|
}));
|
||||||
|
|
||||||
const StyledLinkContainer = styled('div')(({ theme }) => ({
|
const StyledLinkContainer = styled('div')(({ theme }) => ({
|
||||||
margin: theme.spacing(3, 0),
|
margin: theme.spacing(3, 0),
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -195,6 +204,7 @@ const FormTemplate: React.FC<ICreateProps> = ({
|
|||||||
description,
|
description,
|
||||||
children,
|
children,
|
||||||
documentationLink,
|
documentationLink,
|
||||||
|
documentationIcon,
|
||||||
documentationLinkLabel,
|
documentationLinkLabel,
|
||||||
loading,
|
loading,
|
||||||
modal,
|
modal,
|
||||||
@ -261,6 +271,7 @@ const FormTemplate: React.FC<ICreateProps> = ({
|
|||||||
<StyledRelativeDiv>
|
<StyledRelativeDiv>
|
||||||
<MobileGuidance
|
<MobileGuidance
|
||||||
description={description}
|
description={description}
|
||||||
|
documentationIcon={documentationIcon}
|
||||||
documentationLink={documentationLink}
|
documentationLink={documentationLink}
|
||||||
documentationLinkLabel={documentationLinkLabel}
|
documentationLinkLabel={documentationLinkLabel}
|
||||||
/>
|
/>
|
||||||
@ -300,6 +311,7 @@ const FormTemplate: React.FC<ICreateProps> = ({
|
|||||||
condition={showGuidance && !smallScreen}
|
condition={showGuidance && !smallScreen}
|
||||||
show={
|
show={
|
||||||
<Guidance
|
<Guidance
|
||||||
|
documentationIcon={documentationIcon}
|
||||||
description={description}
|
description={description}
|
||||||
documentationLink={documentationLink}
|
documentationLink={documentationLink}
|
||||||
documentationLinkLabel={documentationLinkLabel}
|
documentationLinkLabel={documentationLinkLabel}
|
||||||
@ -318,8 +330,9 @@ const FormTemplate: React.FC<ICreateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
interface IMobileGuidance {
|
interface IMobileGuidance {
|
||||||
description: string;
|
description: ReactNode;
|
||||||
documentationLink: string;
|
documentationLink: string;
|
||||||
|
documentationIcon?: ReactNode;
|
||||||
documentationLinkLabel?: string;
|
documentationLinkLabel?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,6 +340,7 @@ const MobileGuidance = ({
|
|||||||
description,
|
description,
|
||||||
documentationLink,
|
documentationLink,
|
||||||
documentationLinkLabel,
|
documentationLinkLabel,
|
||||||
|
documentationIcon,
|
||||||
}: IMobileGuidance) => {
|
}: IMobileGuidance) => {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
@ -345,6 +359,7 @@ const MobileGuidance = ({
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Collapse in={open} timeout={500}>
|
<Collapse in={open} timeout={500}>
|
||||||
<Guidance
|
<Guidance
|
||||||
|
documentationIcon={documentationIcon}
|
||||||
description={description}
|
description={description}
|
||||||
documentationLink={documentationLink}
|
documentationLink={documentationLink}
|
||||||
documentationLinkLabel={documentationLinkLabel}
|
documentationLinkLabel={documentationLinkLabel}
|
||||||
@ -356,6 +371,7 @@ const MobileGuidance = ({
|
|||||||
|
|
||||||
interface IGuidanceProps {
|
interface IGuidanceProps {
|
||||||
description: string;
|
description: string;
|
||||||
|
documentationIcon?: ReactNode;
|
||||||
documentationLink: string;
|
documentationLink: string;
|
||||||
documentationLinkLabel?: string;
|
documentationLinkLabel?: string;
|
||||||
showDescription?: boolean;
|
showDescription?: boolean;
|
||||||
@ -366,6 +382,7 @@ const Guidance: React.FC<IGuidanceProps> = ({
|
|||||||
description,
|
description,
|
||||||
children,
|
children,
|
||||||
documentationLink,
|
documentationLink,
|
||||||
|
documentationIcon,
|
||||||
documentationLinkLabel = 'Learn more',
|
documentationLinkLabel = 'Learn more',
|
||||||
showDescription = true,
|
showDescription = true,
|
||||||
showLink = true,
|
showLink = true,
|
||||||
@ -374,7 +391,15 @@ const Guidance: React.FC<IGuidanceProps> = ({
|
|||||||
<StyledSidebar>
|
<StyledSidebar>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={showDescription}
|
condition={showDescription}
|
||||||
show={<StyledDescription>{description}</StyledDescription>}
|
show={
|
||||||
|
<StyledDescriptionCard>
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={!!documentationIcon}
|
||||||
|
show={documentationIcon}
|
||||||
|
/>
|
||||||
|
<StyledDescription>{description}</StyledDescription>
|
||||||
|
</StyledDescriptionCard>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { formatUnknownError } from 'utils/formatUnknownError';
|
import { formatUnknownError } from 'utils/formatUnknownError';
|
||||||
|
import StickinessIcon from '@mui/icons-material/FormatPaint';
|
||||||
import useProjectApi from 'hooks/api/actions/useProjectApi/useProjectApi';
|
import useProjectApi from 'hooks/api/actions/useProjectApi/useProjectApi';
|
||||||
import useToast from 'hooks/useToast';
|
import useToast from 'hooks/useToast';
|
||||||
import FormTemplate from 'component/common/FormTemplate/FormTemplate';
|
import FormTemplate from 'component/common/FormTemplate/FormTemplate';
|
||||||
@ -116,6 +117,7 @@ export const CreateProjectDialogue = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledDialog open={open} onClose={onClose}>
|
<StyledDialog open={open} onClose={onClose}>
|
||||||
<FormTemplate
|
<FormTemplate
|
||||||
@ -123,6 +125,7 @@ export const CreateProjectDialogue = ({
|
|||||||
description={documentation}
|
description={documentation}
|
||||||
documentationLink='https://docs.getunleash.io/reference/projects'
|
documentationLink='https://docs.getunleash.io/reference/projects'
|
||||||
documentationLinkLabel='Projects documentation'
|
documentationLinkLabel='Projects documentation'
|
||||||
|
documentationIcon={<StickinessIcon />}
|
||||||
formatApiCode={formatApiCode}
|
formatApiCode={formatApiCode}
|
||||||
>
|
>
|
||||||
<NewProjectForm
|
<NewProjectForm
|
||||||
|
Loading…
Reference in New Issue
Block a user