Files
tlsn-plugin-demo/web/components/Button/index.tsx
tsukino 3f89b56fcc Interactive verifier demo (#35)
* Add interactive verifier demo
* Serve and load plugin from local file
* Show screenname at the end + removed attestation code
* No more need for tlsn-js
* Updated Docker container
* Use environment variable to enable/disable POAPs
* Improved UI
* use LRU for tracking sessions

Co-authored-by: Hendrik Eeckhaut <hendrik@eeckhaut.org>
2025-08-26 11:16:25 +02:00

50 lines
1.3 KiB
TypeScript

import React, { ButtonHTMLAttributes, ReactElement } from 'react';
import classNames from 'classnames';
import './index.scss';
import Icon from '../Icon';
type Props = {
className?: string;
btnType?: 'primary' | 'secondary' | '';
loading?: boolean;
} & ButtonHTMLAttributes<HTMLButtonElement>;
export default function Button(props: Props): ReactElement {
const {
className,
btnType = '',
children,
onClick,
disabled,
loading,
// Must select all non-button props here otherwise react-dom will show warning
...btnProps
} = props;
return (
<button
className={classNames(
'flex flex-row flex-nowrap items-center',
'h-10 px-4 button transition-colors',
{
'button--primary': btnType === 'primary',
'button--secondary': btnType === 'secondary',
'cursor-default': disabled || loading,
},
className,
)}
onClick={!disabled && !loading ? onClick : undefined}
disabled={disabled || loading}
{...btnProps}
>
{loading ? (
<>
<span>Running TLSNotary plugin...</span>
<div className="animate-spin rounded-full h-5 w-5 border-2 border-white border-t-transparent"></div>
</>
) : (
children
)}
</button>
);
}