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

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

Loading…
Cancel
Save