improve: code style and some subtle changes
This commit is contained in:
parent
6b93a781b7
commit
cbd46d4030
@ -143,8 +143,8 @@ const SignUpForm: React.FC<RegistrationFormProps> = ({ backendURL }) => {
|
|||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
className="bg-primary dark:bg-dark-primary text-on-primary dark:text-dark-on-primary duration-150
|
className="bg-primary dark:bg-dark-primary text-on-primary dark:text-dark-on-primary duration-150
|
||||||
rounded-full hover:bg-on-primary-container hover:dark:bg-dark-on-primary-container mt-2
|
rounded-full hover:bg-on-primary-container hover:dark:bg-dark-on-primary-container mt-2
|
||||||
flex items-center text-sm leading-5 justify-center h-10 w-full"
|
flex items-center text-sm leading-5 justify-center h-10 w-full"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
|
@ -11,7 +11,7 @@ export default function SignupPage() {
|
|||||||
>
|
>
|
||||||
<p className="mb-2">
|
<p className="mb-2">
|
||||||
<a href="/">
|
<a href="/">
|
||||||
<LeftArrow className="inline -translate-y-[0.1rem] scale-90" aria-hidden="true" />
|
<LeftArrow className="inline -translate-y-0.5 scale-90 mr-1" aria-hidden="true" />
|
||||||
首页
|
首页
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
@ -30,10 +30,10 @@ export default function SignupPage() {
|
|||||||
已有账户?
|
已有账户?
|
||||||
<a href="/login">
|
<a href="/login">
|
||||||
<span>登录</span>
|
<span>登录</span>
|
||||||
<RightArrow className="text-xs inline -translate-y-0.5" aria-hidden="true" />
|
<RightArrow className="text-xs inline -translate-y-0.5 ml-1" aria-hidden="true" />
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<SignUpForm backendURL={process.env.BACKEND_URL} />
|
<SignUpForm backendURL={process.env.BACKEND_URL ?? ""} />
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
|
@ -35,7 +35,7 @@ export const HeaderDestop = () => {
|
|||||||
className="inline-flex relative gap-6 h-full lg:right-12
|
className="inline-flex relative gap-6 h-full lg:right-12
|
||||||
text-xl font-medium items-center w-[15rem] min-w-[8rem] mr-4 lg:mr-0 lg:w-[305px] justify-end"
|
text-xl font-medium items-center w-[15rem] min-w-[8rem] mr-4 lg:mr-0 lg:w-[305px] justify-end"
|
||||||
>
|
>
|
||||||
<a href="/register">注册</a>
|
<a href="/signup">注册</a>
|
||||||
<a href="/about">关于</a>
|
<a href="/about">关于</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -71,7 +71,7 @@ export const HeaderMobile = () => {
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full h-14 flex items-center px-4">
|
<div className="w-full h-14 flex items-center px-4">
|
||||||
<a href="/register" className="flex">
|
<a href="/signup" className="flex">
|
||||||
<RegisterIcon className="text-2xl pr-4" />
|
<RegisterIcon className="text-2xl pr-4" />
|
||||||
<span>注册</span>
|
<span>注册</span>
|
||||||
</a>
|
</a>
|
||||||
|
13
packages/next/components/ui/TextField.css
Normal file
13
packages/next/components/ui/TextField.css
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
|
||||||
|
.border-middle-idle-empty {
|
||||||
|
@apply border-y-[1px];
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-middle-idle {
|
||||||
|
@apply border-y-[1px] border-t-0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-middle-focus {
|
||||||
|
@apply border-primary dark:border-dark-primary border-y-2 border-t-0;
|
||||||
|
}
|
@ -9,9 +9,10 @@ interface InputProps extends React.HTMLAttributes<HTMLDivElement> {
|
|||||||
onInputTextChange?: (value: string) => void;
|
onInputTextChange?: (value: string) => void;
|
||||||
maxChar?: number;
|
maxChar?: number;
|
||||||
supportingText?: string;
|
supportingText?: string;
|
||||||
|
variant: "filled" | "outlined" | "standard";
|
||||||
}
|
}
|
||||||
|
|
||||||
const TextField: React.FC<InputProps> = ({
|
const OutlineTextField: React.FC<InputProps> = ({
|
||||||
labelText = "",
|
labelText = "",
|
||||||
type = "text",
|
type = "text",
|
||||||
inputText: initialInputText = "",
|
inputText: initialInputText = "",
|
||||||
@ -35,23 +36,28 @@ const TextField: React.FC<InputProps> = ({
|
|||||||
<div className="absolute flex top-0 left-0 h-full w-full">
|
<div className="absolute flex top-0 left-0 h-full w-full">
|
||||||
<div
|
<div
|
||||||
className={`w-3 rounded-l-sm border-outline dark:border-dark-outline
|
className={`w-3 rounded-l-sm border-outline dark:border-dark-outline
|
||||||
${focus ? "border-primary dark:border-dark-primary border-l-2 border-y-2" : "border-l-[1px] border-y-[1px] "}
|
${
|
||||||
`}
|
focus
|
||||||
|
? "border-primary dark:border-dark-primary border-l-2 border-y-2"
|
||||||
|
: "border-l-[1px] border-y-[1px] "
|
||||||
|
}
|
||||||
|
`}
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={`px-1 border-outline dark:border-dark-outline transition-none
|
className={`px-1 border-outline dark:border-dark-outline transition-none
|
||||||
${!focus && !inputText ? "border-y-[1px]" : ""}
|
${!focus && !inputText ? "border-y-[1px]" : ""}
|
||||||
${!focus && inputText ? "border-y-[1px] border-t-0" : ""}
|
${!focus && inputText ? "border-y-[1px] border-t-0" : ""}
|
||||||
${focus ? "border-primary dark:border-dark-primary border-y-2 border-t-0" : ""}
|
${focus ? "border-primary dark:border-dark-primary border-y-2 border-t-0" : ""}
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className={`
|
className={`
|
||||||
relative leading-6 text-base text-on-surface-variant dark:text-dark-on-surface-variant duration-150
|
relative leading-6 text-base text-on-surface-variant
|
||||||
${focus || inputText ? "-top-3 text-xs leading-4" : "top-4"}
|
dark:text-dark-on-surface-variant duration-150
|
||||||
${focus ? "text-primary dark:text-dark-primary" : ""}
|
${focus || inputText ? "-top-3 text-xs leading-4" : "top-4"}
|
||||||
`}
|
${focus ? "text-primary dark:text-dark-primary" : ""}
|
||||||
|
`}
|
||||||
>
|
>
|
||||||
{labelText}
|
{labelText}
|
||||||
</span>
|
</span>
|
||||||
@ -59,8 +65,10 @@ const TextField: React.FC<InputProps> = ({
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
className={`flex-grow rounded-r-sm border-outline dark:border-dark-outline
|
className={`flex-grow rounded-r-sm border-outline dark:border-dark-outline
|
||||||
${focus ? "border-primary dark:border-dark-primary border-r-2 border-y-2" : "border-r-[1px] border-y-[1px] "}
|
${focus ?
|
||||||
`}
|
"border-primary dark:border-dark-primary border-r-2 border-y-2" :
|
||||||
|
"border-r-[1px] border-y-[1px] "}
|
||||||
|
`}
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -75,12 +83,12 @@ const TextField: React.FC<InputProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
{(supportingText || maxChar) && (
|
{(supportingText || maxChar) && (
|
||||||
<div
|
<div
|
||||||
className="w-full relative mt-1 text-on-surface-variant dark:text-dark-on-surface-variant
|
className="w-full relative mt-1 text-on-surface-variant
|
||||||
text-xs leading-4 h-4"
|
dark:text-dark-on-surface-variant text-xs leading-4 h-4"
|
||||||
>
|
>
|
||||||
{supportingText && <span className="absolute left-4">{supportingText}</span>}
|
{supportingText && <span className="absolute left-4">{supportingText}</span>}
|
||||||
{maxChar && (
|
{maxChar && (
|
||||||
<span className="absolute right-4">
|
<span className={`absolute right-4 ${inputText.length > maxChar ? "text-red-500" : ""}`}>
|
||||||
{inputText.length}/{maxChar}
|
{inputText.length}/{maxChar}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@ -90,4 +98,10 @@ const TextField: React.FC<InputProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const TextField: React.FC<InputProps> = (props) => {
|
||||||
|
if (!props.variant || props.variant === "outlined") {
|
||||||
|
return <OutlineTextField {...props} />;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export default TextField;
|
export default TextField;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
/* config options here */
|
devIndicators: false
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
Loading…
Reference in New Issue
Block a user