mirror of
https://github.com/grafana/grafana.git
synced 2026-08-26 13:27:30 -05:00
Grafana UI: SecretTextArea - Replace HorizontalGroup with Stack and Box (#85849)
This commit is contained in:
@@ -880,9 +880,6 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-ui/src/components/PanelChrome/index.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.tsx:5381": [
|
||||
[0, 0, 0, "\'HorizontalGroup\' import from \'../Layout/Layout\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Segment/SegmentSelect.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
|
||||
@@ -5,7 +5,8 @@ import { GrafanaTheme2 } from '@grafana/data';
|
||||
|
||||
import { useStyles2 } from '../../themes/ThemeContext';
|
||||
import { Button } from '../Button';
|
||||
import { HorizontalGroup } from '../Layout/Layout';
|
||||
import { Box } from '../Layout/Box/Box';
|
||||
import { Stack } from '../Layout/Stack/Stack';
|
||||
import { TextArea } from '../TextArea/TextArea';
|
||||
|
||||
export type Props = React.ComponentProps<typeof TextArea> & {
|
||||
@@ -35,16 +36,24 @@ const getStyles = (theme: GrafanaTheme2) => {
|
||||
export const SecretTextArea = ({ isConfigured, onReset, ...props }: Props) => {
|
||||
const styles = useStyles2(getStyles);
|
||||
return (
|
||||
<HorizontalGroup>
|
||||
{!isConfigured && <TextArea {...props} />}
|
||||
{isConfigured && (
|
||||
<TextArea {...props} rows={1} disabled={true} value={CONFIGURED_TEXT} className={cx(styles.configuredStyle)} />
|
||||
)}
|
||||
<Stack>
|
||||
<Box>
|
||||
{!isConfigured && <TextArea {...props} />}
|
||||
{isConfigured && (
|
||||
<TextArea
|
||||
{...props}
|
||||
rows={1}
|
||||
disabled={true}
|
||||
value={CONFIGURED_TEXT}
|
||||
className={cx(styles.configuredStyle)}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
{isConfigured && (
|
||||
<Button onClick={onReset} variant="secondary">
|
||||
{RESET_BUTTON_TEXT}
|
||||
</Button>
|
||||
)}
|
||||
</HorizontalGroup>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user