replace default exports with named

This commit is contained in:
vchikalkin 2024-05-02 21:02:03 +03:00
parent 26a7092d74
commit 8d42ab56c8
10 changed files with 42 additions and 13 deletions

View File

@ -1,14 +1,12 @@
import styles from './Form.module.scss';
import { publicRuntimeConfig } from '@/config/runtime';
import Button from '@/elements/Button';
import Error from '@/elements/Error';
import Input from '@/elements/Input';
import { Button, Error, Input } from '@/elements';
import axios from 'axios';
import { useState } from 'react';
const { APP_BASE_PATH } = publicRuntimeConfig;
export default function Form() {
export function Form() {
const [hasError, setHasError] = useState(false);
const error = hasError ? <Error>Неверный логин или пароль</Error> : null;

View File

@ -1,8 +1,8 @@
import Form from './Form';
import { Form } from './Form';
import styles from './Login.module.scss';
import Logo from '@/elements/Logo';
import { Logo } from '@/elements';
export default function Login() {
export function Login() {
return (
<div className={styles.wrapper}>
<div className={styles.login}>

View File

@ -0,0 +1,2 @@
export * from './Form';
export * from './Login';

View File

@ -3,7 +3,7 @@ import styles from './Button.module.css';
type ButtonProps = JSX.IntrinsicElements['button'];
export default function Button({ children, ...props }: ButtonProps) {
export function Button({ children, ...props }: ButtonProps) {
return (
<button className={styles.btn} {...props}>
{children}

View File

@ -1,5 +1,5 @@
import styles from './Error.module.css';
export default function Error({ children }) {
export function Error({ children }) {
return <span className={styles.error}>{children}</span>;
}

View File

@ -2,6 +2,6 @@ import styles from './Input.module.css';
type InputProps = JSX.IntrinsicElements['input'];
export default function Input(props: InputProps) {
export function Input(props: InputProps) {
return <input className={styles.input} {...props} />;
}

View File

@ -1,6 +1,6 @@
import Image from 'next/image';
import logo from 'public/assets/images/logo-primary.svg';
export default function Logo() {
export function Logo() {
return <Image src={logo} alt="logo" width={154} />;
}

View File

@ -0,0 +1,5 @@
export * from './Button';
export * from './Error';
export * from './H';
export * from './Input';
export * from './Logo';

View File

@ -1,4 +1,4 @@
import Login from '@/components/Login';
import { Login } from '@/components';
import { publicRuntimeConfig } from '@/config/runtime';
import Head from 'next/head';
@ -13,7 +13,7 @@ function PageHead() {
);
}
export default function Home() {
export default function Page() {
return (
<>
<PageHead />

View File

@ -0,0 +1,24 @@
import { Login } from '@/components';
import { publicRuntimeConfig } from '@/config/runtime';
import Head from 'next/head';
const { APP_DESCRIPTION } = publicRuntimeConfig;
function PageHead() {
return (
<Head>
<title>{`Вход - ${APP_DESCRIPTION}`}</title>
<meta name="description" content={APP_DESCRIPTION} />
</Head>
);
}
export default function Page() {
return (
<>
<PageHead />
Telegram
<Login />
</>
);
}