11import { Props } from '../../utils/types' ;
22import { CopyButton } from './CopyButton' ;
33import { ToastNotification } from './ToastNotification' ;
4+ import { useState } from 'react' ;
5+ import { Eye , EyeOff } from 'lucide-react' ;
46
57export const Hero = ( props : Props ) => {
8+ const [ showUuid , setShowUuid ] = useState ( true ) ;
9+ const [ showSecret , setShowSecret ] = useState ( true ) ;
10+
11+ const createMask = ( text : string ) => '•' . repeat ( text . length ) ;
12+
613 return (
714 < section id = "#" className = "container py-20 md:py-32" >
815 < div className = "text-center lg:text-start space-y-6" >
@@ -38,8 +45,21 @@ export const Hero = (props: Props) => {
3845 < h3 className = "text-xl text-foreground font-semibold" > UUID</ h3 >
3946 < div className = "mt-4 flex items-center" >
4047 < div className = "bg-gray-900 text-white p-4 rounded-lg relative flex-grow-1 overflow-x-auto" >
41- < code className = "whitespace-nowrap" > { props . uuid } </ code >
48+ < code className = "whitespace-nowrap" >
49+ { showUuid ? props . uuid : createMask ( props . uuid ) }
50+ </ code >
4251 </ div >
52+ < button
53+ onClick = { ( ) => setShowUuid ( ! showUuid ) }
54+ className = "text-white font-bold p-2 rounded-full m-2"
55+ aria-label = { showUuid ? 'Hide UUID' : 'Show UUID' }
56+ >
57+ { showUuid ? (
58+ < EyeOff className = "size-5" />
59+ ) : (
60+ < Eye className = "size-5" />
61+ ) }
62+ </ button >
4363 < CopyButton text = { props . uuid } label = "UUID" />
4464 </ div >
4565 < br > </ br >
@@ -50,9 +70,22 @@ export const Hero = (props: Props) => {
5070 < div className = "mt-4 flex items-center" >
5171 < div className = "bg-gray-900 text-white p-4 rounded-lg relative flex-grow-1 overflow-x-auto" >
5272 < code className = "whitespace-nowrap" >
53- { props . encryption_secret }
73+ { showSecret
74+ ? props . encryption_secret
75+ : createMask ( props . encryption_secret ) }
5476 </ code >
5577 </ div >
78+ < button
79+ onClick = { ( ) => setShowSecret ( ! showSecret ) }
80+ className = "text-white font-bold p-2 rounded-full m-2"
81+ aria-label = { showSecret ? 'Hide secret' : 'Show secret' }
82+ >
83+ { showSecret ? (
84+ < EyeOff className = "size-5" />
85+ ) : (
86+ < Eye className = "size-5" />
87+ ) }
88+ </ button >
5689 < CopyButton
5790 text = { props . encryption_secret }
5891 label = "Encryption Secret"
0 commit comments