fix(striker-ui): expose reveal button props, allow adjust line height in SensitiveText

main
Tsu-ba-me 2 years ago
parent 2ec8031e0e
commit 0edb8910c2
  1. 9
      striker-ui/components/Text/SensitiveText.tsx
  2. 2
      striker-ui/types/SensitiveText.d.ts

@ -32,7 +32,9 @@ const SensitiveText: FC<SensitiveTextProps> = ({
children,
inline: isInline = false,
monospaced: isMonospaced = false,
revealButtonProps,
revealInitially: isRevealInitially = false,
textLineHeight = 2.8,
textProps,
}) => {
const [isReveal, setIsReveal] = useState<boolean>(isRevealInitially);
@ -42,8 +44,8 @@ const SensitiveText: FC<SensitiveTextProps> = ({
}, []);
const textSxLineHeight = useMemo<number | string | undefined>(
() => (isInline ? undefined : 2.8),
[isInline],
() => (isInline ? undefined : textLineHeight || undefined),
[isInline, textLineHeight],
);
const textElementType = useMemo(
@ -101,10 +103,11 @@ const SensitiveText: FC<SensitiveTextProps> = ({
state={String(isReveal)}
sx={{ marginRight: '-.2em', padding: '.2em' }}
variant="normal"
{...revealButtonProps}
/>
</FlexBox>
),
[clickEventHandler, contentElement, isInline, isReveal],
[clickEventHandler, contentElement, revealButtonProps, isInline, isReveal],
);
return rootElement;

@ -1,7 +1,9 @@
type SensitiveTextOptionalProps = {
inline?: boolean;
monospaced?: boolean;
revealButtonProps?: import('../components/IconButton').IconButtonProps;
revealInitially?: boolean;
textLineHeight?: number | null;
textProps?: import('../components/Text').BodyTextProps;
};

Loading…
Cancel
Save