Логотип вынесен в public, создан компонент для удобства использования

This commit is contained in:
Александр Сироткин 2022-02-25 11:39:06 +05:00
parent 6b6020758b
commit 8f451035f7
6 changed files with 23 additions and 15 deletions

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -6,15 +6,15 @@ import {
import { ConfigProvider } from 'antd' import { ConfigProvider } from 'antd'
import locale from 'antd/lib/locale/ru_RU' import locale from 'antd/lib/locale/ru_RU'
import { OpenAPI } from './services/api' import { OpenAPI } from '@api'
import { getUserToken } from './utils/storage' import { getUserToken } from '@utils/storage'
import { PrivateRoute } from './components/Private' import { PrivateRoute } from '@components/Private'
import Main from './pages/Main' import Main from '@pages/Main'
import Login from './pages/Login' import Login from '@pages/Login'
import Register from './pages/Register' import Register from '@pages/Register'
import './styles/App.less' import '@styles/App.less'
//OpenAPI.BASE = 'http://localhost:3000' //OpenAPI.BASE = 'http://localhost:3000'
OpenAPI.TOKEN = async () => getUserToken() OpenAPI.TOKEN = async () => getUserToken()

View File

@ -1,11 +1,12 @@
import { memo } from 'react' import { memo } from 'react'
import { Layout } from 'antd'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import { Layout } from 'antd'
import { BasicProps } from 'antd/lib/layout/layout'
import logo from '@images/logo_32.png'
import { headerHeight } from '@utils' import { headerHeight } from '@utils'
import { UserMenu } from './UserMenu' import { UserMenu } from './UserMenu'
import { BasicProps } from 'antd/lib/layout/layout'
import Logo from '@images/Logo'
export type PageHeaderProps = BasicProps & { export type PageHeaderProps = BasicProps & {
title?: string title?: string
@ -17,7 +18,7 @@ export const PageHeader: React.FC<PageHeaderProps> = memo(({ title = 'Монит
<Layout> <Layout>
<Layout.Header className={'header'} {...other}> <Layout.Header className={'header'} {...other}>
<Link to={'/'} style={{ height: headerHeight }}> <Link to={'/'} style={{ height: headerHeight }}>
<img src={logo} alt={'АСБ'} className={'logo'}/> <Logo />
</Link> </Link>
{children} {children}
<h1 className={'title'}>{title}</h1> <h1 className={'title'}>{title}</h1>

7
src/images/Logo.tsx Normal file
View File

@ -0,0 +1,7 @@
import { memo } from 'react'
export const Logo = memo<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>((props) => (
<img src={'/images/logo_32.png'} alt={'АСБ'} className={'logo'} {...props} />
))
export default Logo

View File

@ -10,9 +10,9 @@ import { invokeWebApiWrapperAsync } from '@components/factory'
import { loginRules, passwordRules } from '@utils/validationRules' import { loginRules, passwordRules } from '@utils/validationRules'
import '@styles/index.css' import '@styles/index.css'
import logo from '@images/logo_32.png' import Logo from '@images/Logo'
const logoIcon = <img src={logo} alt={'АСБ'} className={'logo'} width={130} /> const logoIcon = <Logo width={130} />
export const Login = memo(() => { export const Login = memo(() => {
const history = useHistory() const history = useHistory()

View File

@ -21,7 +21,7 @@ import {
phoneRules phoneRules
} from '@utils/validationRules' } from '@utils/validationRules'
import logo from '@images/logo_32.png' import Logo from '@images/Logo'
const surnameRules = [...nameRules, { required: true, message: 'Пожалуйста, введите фамилию!' }] const surnameRules = [...nameRules, { required: true, message: 'Пожалуйста, введите фамилию!' }]
const regEmailRules = [{ required: true, message: 'Пожалуйста, введите email!' }, ...emailRules] const regEmailRules = [{ required: true, message: 'Пожалуйста, введите email!' }, ...emailRules]
@ -37,7 +37,7 @@ const confirmPasswordRules = [
}) })
] ]
const logoIcon = <img src={logo} alt={'АСБ'} className={'logo'} width={130}/> const logoIcon = <Logo width={130} />
const showPasswordIcon = visible => (visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />) const showPasswordIcon = visible => (visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />)
const createInput = (name, placeholder, rules, isPassword, dependencies) => ( const createInput = (name, placeholder, rules, isPassword, dependencies) => (