From 0edb8910c2531373d4cc9c323f9dc23d74a3f3f8 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Wed, 28 Jun 2023 20:25:38 -0400 Subject: [PATCH] fix(striker-ui): expose reveal button props, allow adjust line height in SensitiveText --- striker-ui/components/Text/SensitiveText.tsx | 9 ++++++--- striker-ui/types/SensitiveText.d.ts | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/striker-ui/components/Text/SensitiveText.tsx b/striker-ui/components/Text/SensitiveText.tsx index 2d1ca11c..9f3e3ffd 100644 --- a/striker-ui/components/Text/SensitiveText.tsx +++ b/striker-ui/components/Text/SensitiveText.tsx @@ -32,7 +32,9 @@ const SensitiveText: FC = ({ children, inline: isInline = false, monospaced: isMonospaced = false, + revealButtonProps, revealInitially: isRevealInitially = false, + textLineHeight = 2.8, textProps, }) => { const [isReveal, setIsReveal] = useState(isRevealInitially); @@ -42,8 +44,8 @@ const SensitiveText: FC = ({ }, []); const textSxLineHeight = useMemo( - () => (isInline ? undefined : 2.8), - [isInline], + () => (isInline ? undefined : textLineHeight || undefined), + [isInline, textLineHeight], ); const textElementType = useMemo( @@ -101,10 +103,11 @@ const SensitiveText: FC = ({ state={String(isReveal)} sx={{ marginRight: '-.2em', padding: '.2em' }} variant="normal" + {...revealButtonProps} /> ), - [clickEventHandler, contentElement, isInline, isReveal], + [clickEventHandler, contentElement, revealButtonProps, isInline, isReveal], ); return rootElement; diff --git a/striker-ui/types/SensitiveText.d.ts b/striker-ui/types/SensitiveText.d.ts index 65081fa5..6358d145 100644 --- a/striker-ui/types/SensitiveText.d.ts +++ b/striker-ui/types/SensitiveText.d.ts @@ -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; };