-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign check type selection screen (#957)
* feat: redesign check type selection screen * feat: add new status badge * fix: change check group icon color * fix: lint * feat: add new icons to check types This creates a dependency to @grafana/data 11.3.0 as they've been recently added there. * chore: update grafana version dependency * chore: update yarn lockfile * fix: update files after merge with main * fix: update after merge with main * fix: use old icons until grafana 11.4.0 is published * fix: tests * fix: prevent showing 3 columns of check cards * fix: improve styling and breakpoint transitions * fix: show newStatusBadge on check's form * fix: change tests not to use data-test-id * fix: positioning of Toggletip in check's form - workaround to fix the bug in floating-ui when setting containerType: inline-size - more info here floating-ui/floating-ui#3067 * fix: address review comments * fix: address review comments * fix: add container queries
- Loading branch information
Showing
10 changed files
with
351 additions
and
265 deletions.
There are no files selected for viewing
77 changes: 0 additions & 77 deletions
77
src/components/CheckEditor/FormComponents/CheckStatusBadge.tsx
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
src/components/CheckEditor/FormComponents/CheckStatusInfo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React from 'react'; | ||
import { GrafanaTheme2 } from '@grafana/data'; | ||
import { Badge, Icon, Stack, TextLink, useStyles2 } from '@grafana/ui'; | ||
import { css } from '@emotion/css'; | ||
|
||
import { CheckStatus } from 'types'; | ||
import { Toggletip } from 'components/Toggletip'; | ||
|
||
export interface CheckStatusInfoProps { | ||
description?: string; | ||
docsLink?: string; | ||
value?: CheckStatus; | ||
} | ||
|
||
export const CheckStatusInfo = ({ description, docsLink }: CheckStatusInfoProps) => { | ||
const styles = useStyles2((theme: GrafanaTheme2) => getStyles(theme)); | ||
|
||
return ( | ||
<Stack> | ||
<Toggletip | ||
content={ | ||
<div> | ||
{description} | ||
{docsLink && ( | ||
<> | ||
{` `} | ||
<TextLink href={docsLink} external variant="bodySmall"> | ||
Read more | ||
</TextLink> | ||
</> | ||
)} | ||
</div> | ||
} | ||
> | ||
<button className={styles.infoLink} type="button"> | ||
<Icon name={`info-circle`} size={'lg'} className={styles.infoIcon} /> | ||
</button> | ||
</Toggletip> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export const NewStatusBadge = ({ status, className }: { status: CheckStatus; className?: string }) => { | ||
if (![CheckStatus.EXPERIMENTAL, CheckStatus.PRIVATE_PREVIEW, CheckStatus.PUBLIC_PREVIEW].includes(status)) { | ||
return null; | ||
} | ||
|
||
return <Badge text={'NEW'} color={'orange'} className={className} />; | ||
}; | ||
|
||
const getStyles = (theme: GrafanaTheme2) => ({ | ||
infoLink: css({ | ||
background: `none`, | ||
border: `none`, | ||
padding: 0, | ||
}), | ||
infoIcon: css({ | ||
color: theme.colors.info.main, | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.