diff --git a/.eslintrc.json b/.eslintrc.json index 59d8be2b..9fadb6d0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -10,6 +10,10 @@ "error", "always-multiline" ], + "quotes": [ + "error", + "double" + ], "no-tabs": "off", "indent": [ "warn", diff --git a/pages/[...slug].tsx b/pages/[...slug].tsx index 4cf42c63..5ae1bf6d 100644 --- a/pages/[...slug].tsx +++ b/pages/[...slug].tsx @@ -1,20 +1,20 @@ -import Head from 'next/head' -import { App } from 'src/components/App' -import { tail } from 'lodash' -import { Page } from 'src/components/Page' -import { Meta } from 'src/components/Meta' -import { MetaBuilder } from 'src/lib/meta' -import { apiGet } from '@/next-lib' -import { GetStaticProps, NextPage } from 'next' -import { IBreadcumbsPart, IMenu, IMeta, ITag, Sign, Token } from '@/types' -import { Html } from 'src/components/Html' -import { Youtube } from '@/components/Youtube' -import { createMenu, createPage, createPageUrls } from '@/remote/factory' -import { paramsToSlug } from '@/remote/lib' -import { PageGrid } from '@/components/PageGrid' -import { useRouter } from 'next/router' -import { FileCard } from '@/components/FIleCard' -import { Picture } from '@/components/Picture' +import Head from "next/head" +import { App } from "src/components/App" +import { tail } from "lodash" +import { Page } from "src/components/Page" +import { Meta } from "src/components/Meta" +import { MetaBuilder } from "src/lib/meta" +import { apiGet } from "@/next-lib" +import { GetStaticProps, NextPage } from "next" +import { IBreadcumbsPart, IMenu, IMeta, ITag, Sign, Token } from "@/types" +import { Html } from "src/components/Html" +import { Youtube } from "@/components/Youtube" +import { createMenu, createPage, createPageUrls } from "@/remote/factory" +import { paramsToSlug } from "@/remote/lib" +import { PageGrid } from "@/components/PageGrid" +import { useRouter } from "next/router" +import { FileCard } from "@/components/FIleCard" +import { Picture } from "@/components/Picture" async function getUrls() { let urls: string[] = [] @@ -59,8 +59,8 @@ const Index: NextPage = props => { return ( = props => { tags={props.tags} date={props.date ? new Date(props.date) : undefined} > -
+
{props.tokens.map((x, i) => { switch (x.token) { - case 'html': + case "html": return ( = props => { /> ) - case 'instagram': + case "instagram": return ( = props => { /> ) - case 'youtube': + case "youtube": return ( = props => { /> ) - case 'image': + case "image": return ( = props => { /> ) - case 'file': + case "file": return ( = props => { /> ) - case 'grid': + case "grid": return ( = async ctx => { } } - const menu = await apiGet(createMenu)('https://hudozka.tmshv.com/menu', () => []) + const menu = await apiGet(createMenu)("https://hudozka.tmshv.com/menu", () => []) const description = page.description ?? undefined const breadcrumbSize = page?.breadcrumb?.length ?? 0 @@ -181,10 +181,10 @@ export const getStaticProps: GetStaticProps = async ctx => { menu, breadcrumb, documentSignature: { - date: '20.01.2021г.', - person: 'Тимашева Марина Геннадьевна', - position: 'Директор', - signature: '0ac4ea89753a4ba9893799442325fb41', + date: "20.01.2021г.", + person: "Тимашева Марина Геннадьевна", + position: "Директор", + signature: "0ac4ea89753a4ba9893799442325fb41", }, }, } @@ -197,7 +197,7 @@ export const getStaticPaths = async () => { fallback: true, paths: urls .map(path => { - const slug = tail(path.split('/')) + const slug = tail(path.split("/")) return { params: { diff --git a/pages/_app.tsx b/pages/_app.tsx index c003de61..b69aeb2e 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,13 +1,13 @@ -import 'src/style/style.css' -import 'src/style/content.css' -import 'src/style/article.css' -import 'src/style/marker/marker-table.css' -import 'src/style/kazimir/video.css' +import "src/style/style.css" +import "src/style/content.css" +import "src/style/article.css" +import "src/style/marker/marker-table.css" +import "src/style/kazimir/video.css" -import App from 'next/app' -import Head from 'next/head' -import { YMetrika } from 'src/components/YMetrika' -import { GAnalytics } from 'src/components/GAnalytics' +import App from "next/app" +import Head from "next/head" +import { YMetrika } from "src/components/YMetrika" +import { GAnalytics } from "src/components/GAnalytics" export default class MyApp extends App { render() { @@ -39,7 +39,7 @@ export default class MyApp extends App { /> - + diff --git a/pages/_document.tsx b/pages/_document.tsx index d3f73450..3adeef60 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -1,4 +1,4 @@ -import { Html, Head, Main, NextScript } from 'next/document' +import { Html, Head, Main, NextScript } from "next/document" export default function Document() { return ( diff --git a/pages/_error.tsx b/pages/_error.tsx index 16f029a2..192cd16d 100644 --- a/pages/_error.tsx +++ b/pages/_error.tsx @@ -1,22 +1,22 @@ -import { NextPage } from 'next' -import { Wrapper } from 'src/components/Wrapper' -import { NotFound } from 'src/components/NotFound' -import { Copyright } from 'src/components/Copyright' -import { Block } from 'src/components/Block' -import { Spacer } from 'src/components/Spacer' +import { NextPage } from "next" +import { Wrapper } from "src/components/Wrapper" +import { NotFound } from "src/components/NotFound" +import { Copyright } from "src/components/Copyright" +import { Block } from "src/components/Block" +import { Spacer } from "src/components/Spacer" const Index: NextPage = () => ( + )} > - + diff --git a/pages/index.tsx b/pages/index.tsx index 51700223..521a293f 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,13 +1,13 @@ -import Head from 'next/head' -import { App } from 'src/components/App' -import { Meta } from 'src/components/Meta' -import { PageGrid } from 'src/components/PageGrid' -import { HudozkaTitle } from 'src/components/HudozkaTitle' -import { MetaBuilder } from 'src/lib/meta' -import { GetStaticProps, NextPage } from 'next' -import { IMenu, IMeta, PageCardDto } from 'src/types' -import { apiGet } from '@/next-lib' -import { createHomeCards, createMenu } from '@/remote/factory' +import Head from "next/head" +import { App } from "src/components/App" +import { Meta } from "src/components/Meta" +import { PageGrid } from "src/components/PageGrid" +import { HudozkaTitle } from "src/components/HudozkaTitle" +import { MetaBuilder } from "src/lib/meta" +import { GetStaticProps, NextPage } from "next" +import { IMenu, IMeta, PageCardDto } from "src/types" +import { apiGet } from "@/next-lib" +import { createHomeCards, createMenu } from "@/remote/factory" type Props = { title: string @@ -28,8 +28,8 @@ const Index: NextPage = props => ( @@ -40,14 +40,14 @@ const Index: NextPage = props => ( ) export const getStaticProps: GetStaticProps = async () => { - const items = await apiGet(createHomeCards)('https://hudozka.tmshv.com/home', async () => []) - const menu = await apiGet(createMenu)('https://hudozka.tmshv.com/menu', () => []) + const items = await apiGet(createHomeCards)("https://hudozka.tmshv.com/home", async () => []) + const menu = await apiGet(createMenu)("https://hudozka.tmshv.com/menu", () => []) - const title = 'Шлиссельбургская ДХШ' + const title = "Шлиссельбургская ДХШ" const meta = (new MetaBuilder()) .setTitle(title) .setData({ - url: '/', + url: "/", }) .build() diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index e76e0b26..4841e8c4 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -1,18 +1,18 @@ -import dynamic from 'next/dynamic' -import { Wrapper } from '../Wrapper' -import { ConfigContext } from 'src/context/ConfigContext' -import config from 'src/config' -import { Footer } from '../Footer' -import { Content } from '../Content' -import { Block } from '../Block' -import { Breadcrumbs } from '../Breadcrumbs' -import { IBreadcumbsPart, IMenu } from 'src/types' -import { useRouter } from 'next/router' -import { useMobile } from 'src/hooks/useMobile' -import { Gosuslugi } from '../Gosuslugi' -import { INavigationProps } from '@/components/Navigation' +import dynamic from "next/dynamic" +import { Wrapper } from "../Wrapper" +import { ConfigContext } from "src/context/ConfigContext" +import config from "src/config" +import { Footer } from "../Footer" +import { Content } from "../Content" +import { Block } from "../Block" +import { Breadcrumbs } from "../Breadcrumbs" +import { IBreadcumbsPart, IMenu } from "src/types" +import { useRouter } from "next/router" +import { useMobile } from "src/hooks/useMobile" +import { Gosuslugi } from "../Gosuslugi" +import { INavigationProps } from "@/components/Navigation" -const Navigation = dynamic(() => import('../Navigation').then(mod => mod.Navigation), { +const Navigation = dynamic(() => import("../Navigation").then(mod => mod.Navigation), { ssr: false, }) @@ -27,7 +27,7 @@ export const App: React.FC = ({ showAuthor = false, menu, ...props }) const hideBreadcrumbs = useMobile() const router = useRouter() const blockStyle = { - justifyContent: 'center', + justifyContent: "center", } return ( @@ -39,10 +39,10 @@ export const App: React.FC = ({ showAuthor = false, menu, ...props }) header={(
{hideBreadcrumbs || !props.breadcrumbs ? null : ( - + = ({ showAuthor = false, menu, ...props }) showAuthor={showAuthor} >
= ({ showAuthor = false, menu, ...props }) )} > - + {props.children} diff --git a/src/components/Block/index.tsx b/src/components/Block/index.tsx index 02a5910e..9c7f368b 100644 --- a/src/components/Block/index.tsx +++ b/src/components/Block/index.tsx @@ -1,16 +1,16 @@ -import s from './styles.module.css' +import s from "./styles.module.css" -import cx from 'classnames' -import { createElement } from 'react' +import cx from "classnames" +import { createElement } from "react" export type BlockProps = { as?: keyof HTMLElementTagNameMap style?: React.CSSProperties - direction: 'horizontal' | 'vertical' + direction: "horizontal" | "vertical" } -export const Block: React.FC = ({ as = 'div', style, direction, ...props }) => { - const directionClass = direction === 'horizontal' +export const Block: React.FC = ({ as = "div", style, direction, ...props }) => { + const directionClass = direction === "horizontal" ? s.horizontal : s.vertical const newProps = { diff --git a/src/components/Breadcrumbs/index.tsx b/src/components/Breadcrumbs/index.tsx index b86b5e68..ab52fcc9 100644 --- a/src/components/Breadcrumbs/index.tsx +++ b/src/components/Breadcrumbs/index.tsx @@ -1,8 +1,8 @@ -import s from './styles.module.css' +import s from "./styles.module.css" -import { IBreadcumbsPart } from 'src/types' -import { Button } from '../Button' -import { insertBetween } from 'src/lib/array' +import { IBreadcumbsPart } from "src/types" +import { Button } from "../Button" +import { insertBetween } from "src/lib/array" export type BreadcrumbsProps = { style?: React.CSSProperties @@ -11,15 +11,15 @@ export type BreadcrumbsProps = { } export const Breadcrumbs: React.FC = props => { - const items = insertBetween(props.items, () => '/') + const items = insertBetween(props.items, () => "/") return (