mirror of https://github.com/msgbyte/tailchat
refactor: 抽象并统一Entry界面按钮样式
parent
de8712129c
commit
c473a70b46
@ -0,0 +1,18 @@
|
||||
import clsx from 'clsx';
|
||||
import React, { InputHTMLAttributes } from 'react';
|
||||
|
||||
export const EntryInput: React.FC<InputHTMLAttributes<HTMLInputElement>> =
|
||||
React.memo((props) => {
|
||||
return (
|
||||
<input
|
||||
{...props}
|
||||
className={clsx(
|
||||
'appearance-none rounded-md relative block w-full px-4 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 text-base mobile:text-sm',
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</input>
|
||||
);
|
||||
});
|
||||
EntryInput.displayName = 'EntryInput';
|
@ -0,0 +1,24 @@
|
||||
import { Spinner } from '@/components/Spinner';
|
||||
import clsx from 'clsx';
|
||||
import React, { ButtonHTMLAttributes } from 'react';
|
||||
|
||||
export const PrimaryBtn: React.FC<
|
||||
ButtonHTMLAttributes<HTMLButtonElement> & {
|
||||
loading?: boolean;
|
||||
}
|
||||
> = React.memo((props) => {
|
||||
return (
|
||||
<button
|
||||
disabled={props.loading}
|
||||
{...props}
|
||||
className={clsx(
|
||||
'w-full py-2 px-4 mb-2 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50',
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.loading && <Spinner />}
|
||||
{props.children}
|
||||
</button>
|
||||
);
|
||||
});
|
||||
PrimaryBtn.displayName = 'PrimaryBtn';
|
@ -0,0 +1,18 @@
|
||||
import clsx from 'clsx';
|
||||
import React, { ButtonHTMLAttributes } from 'react';
|
||||
|
||||
export const SecondaryBtn: React.FC<ButtonHTMLAttributes<HTMLButtonElement>> =
|
||||
React.memo((props) => {
|
||||
return (
|
||||
<button
|
||||
{...props}
|
||||
className={clsx(
|
||||
'w-full py-2 px-4 border border-transparent text-sm font-medium text-white focus:outline-none disabled:opacity-50',
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</button>
|
||||
);
|
||||
});
|
||||
SecondaryBtn.displayName = 'SecondaryBtn';
|
Loading…
Reference in New Issue