mirror of
https://github.com/tlsnotary/tlsn-plugin-demo.git
synced 2026-01-09 21:37:55 -05:00
* 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>
50 lines
1.3 KiB
TypeScript
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>
|
|
);
|
|
}
|