Add Icons page for devs

This commit is contained in:
IRBorisov 2024-06-05 16:20:51 +03:00
parent b5afb6e242
commit 4a56fd3029
5 changed files with 37 additions and 6 deletions

View File

@ -98,6 +98,7 @@
"moprho", "moprho",
"multiword", "multiword",
"mypy", "mypy",
"nocheck",
"nomn", "nomn",
"nooverlap", "nooverlap",
"NPRO", "NPRO",

View File

@ -2,6 +2,7 @@ import { createBrowserRouter } from 'react-router-dom';
import CreateItemPage from '@/pages/CreateItemPage'; import CreateItemPage from '@/pages/CreateItemPage';
import HomePage from '@/pages/HomePage'; import HomePage from '@/pages/HomePage';
import IconsPage from '@/pages/IconsPage';
import LibraryPage from '@/pages/LibraryPage'; import LibraryPage from '@/pages/LibraryPage';
import LoginPage from '@/pages/LoginPage'; import LoginPage from '@/pages/LoginPage';
import ManualsPage from '@/pages/ManualsPage'; import ManualsPage from '@/pages/ManualsPage';
@ -62,6 +63,10 @@ export const Router = createBrowserRouter([
path: `${routes.oss}/:id`, path: `${routes.oss}/:id`,
element: <OssPage /> element: <OssPage />
}, },
{
path: `${routes.icons}`,
element: <IconsPage />
},
{ {
path: routes.manuals, path: routes.manuals,
element: <ManualsPage /> element: <ManualsPage />

View File

@ -18,7 +18,8 @@ export const routes = {
manuals: 'manuals', manuals: 'manuals',
help: 'manuals', help: 'manuals',
rsforms: 'rsforms', rsforms: 'rsforms',
oss: 'oss' oss: 'oss',
icons: 'icons'
}; };
interface SchemaProps { interface SchemaProps {

View File

@ -127,7 +127,7 @@ export interface IconProps {
className?: string; className?: string;
} }
function IconSVG({ viewBox, size = '1.5rem', className, props, children }: IconSVGProps) { function MetaIconSVG({ viewBox, size = '1.5rem', className, props, children }: IconSVGProps) {
return ( return (
<svg <svg
width={size} width={size}
@ -144,18 +144,18 @@ function IconSVG({ viewBox, size = '1.5rem', className, props, children }: IconS
export function IconManuals(props: IconProps) { export function IconManuals(props: IconProps) {
return ( return (
<IconSVG viewBox='0 0 20 20' {...props}> <MetaIconSVG viewBox='0 0 20 20' {...props}>
<path d='M3.33 8L10 12l10-6-10-6L0 6h10v2H3.33zM0 8v8l2-2.22V9.2L0 8zm10 12l-5-3-2-1.2v-6l7 4.2 7-4.2v6L10 20z' /> <path d='M3.33 8L10 12l10-6-10-6L0 6h10v2H3.33zM0 8v8l2-2.22V9.2L0 8zm10 12l-5-3-2-1.2v-6l7 4.2 7-4.2v6L10 20z' />
</IconSVG> </MetaIconSVG>
); );
} }
export function IconLogin(props: IconProps) { export function IconLogin(props: IconProps) {
return ( return (
<IconSVG viewBox='0 0 24 24' {...props}> <MetaIconSVG viewBox='0 0 24 24' {...props}>
<path fill='none' d='M0 0h24v24H0z' /> <path fill='none' d='M0 0h24v24H0z' />
<path d='M10 11H4V3a1 1 0 011-1h14a1 1 0 011 1v18a1 1 0 01-1 1H5a1 1 0 01-1-1v-8h6v3l5-4-5-4v3z' /> <path d='M10 11H4V3a1 1 0 011-1h14a1 1 0 011 1v18a1 1 0 01-1 1H5a1 1 0 01-1-1v-8h6v3l5-4-5-4v3z' />
</IconSVG> </MetaIconSVG>
); );
} }

View File

@ -0,0 +1,24 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import * as icons from '@/components/Icons';
export function IconsPage() {
return (
<div className='flex flex-col items-center px-6 py-3'>
<h1 className='mb-6'>Список иконок</h1>
<div className='grid grid-cols-4'>
{Object.keys(icons)
.filter(key => key.startsWith('Icon'))
.map((key, index) => (
<div key={`icons_list_${index}`} className='flex flex-col items-center px-3 pb-6'>
<p>{icons[key]({ size: '2rem' })}</p>
<p>{key}</p>
</div>
))}
</div>
</div>
);
}
export default IconsPage;