fix eslint errors
This commit is contained in:
1 parent
a732ec0640
commit
86a02a945b
12 files changed
+89
-89
No files matched your search
+58
-59
@@ -79,67 +79,67 @@ const Index: NextPage<Props> = props => {
|
|||||||
<article className={'article'}>
|
<article className={'article'}>
|
||||||
{props.tokens.map((x, i) => {
|
{props.tokens.map((x, i) => {
|
||||||
switch (x.token) {
|
switch (x.token) {
|
||||||
case 'html':
|
case 'html':
|
||||||
return (
|
return (
|
||||||
<Html
|
<Html
|
||||||
key={i}
|
key={i}
|
||||||
html={x.data}
|
html={x.data}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
case 'instagram':
|
case 'instagram':
|
||||||
return (
|
return (
|
||||||
<Html
|
<Html
|
||||||
key={i}
|
key={i}
|
||||||
html={x.data.embed}
|
html={x.data.embed}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
case 'youtube':
|
case 'youtube':
|
||||||
return (
|
return (
|
||||||
<Youtube
|
<Youtube
|
||||||
key={i}
|
key={i}
|
||||||
url={x.data.url}
|
url={x.data.url}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
case 'image':
|
case 'image':
|
||||||
return (
|
return (
|
||||||
<Picture
|
<Picture
|
||||||
key={i}
|
key={i}
|
||||||
src={x.data.src}
|
src={x.data.src}
|
||||||
alt={x.data.alt}
|
alt={x.data.alt}
|
||||||
width={x.data.width}
|
width={x.data.width}
|
||||||
height={x.data.height}
|
height={x.data.height}
|
||||||
caption={x.data.caption}
|
caption={x.data.caption}
|
||||||
blur={x.data.blur}
|
blur={x.data.blur}
|
||||||
wide={x.wide}
|
wide={x.wide}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
case 'file':
|
case 'file':
|
||||||
return (
|
return (
|
||||||
<FileCard
|
<FileCard
|
||||||
key={i}
|
key={i}
|
||||||
sign={props.documentSignature}
|
sign={props.documentSignature}
|
||||||
{...x.data}
|
{...x.data}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
case 'grid':
|
case 'grid':
|
||||||
return (
|
return (
|
||||||
<PageGrid
|
<PageGrid
|
||||||
key={i}
|
key={i}
|
||||||
items={x.data.items}
|
items={x.data.items}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<pre key={i}>
|
<pre key={i}>
|
||||||
{JSON.stringify(x)}
|
{JSON.stringify(x)}
|
||||||
</pre>
|
</pre>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
</article>
|
</article>
|
||||||
@@ -158,8 +158,7 @@ export const getStaticProps: GetStaticProps<Props> = async ctx => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const menu = await apiGet(createMenu)
|
const menu = await apiGet(createMenu)('https://hudozka.tmshv.com/menu', () => [])
|
||||||
('https://hudozka.tmshv.com/menu', () => [])
|
|
||||||
|
|
||||||
const description = page.description ?? undefined
|
const description = page.description ?? undefined
|
||||||
const breadcrumbSize = page?.breadcrumb?.length ?? 0
|
const breadcrumbSize = page?.breadcrumb?.length ?? 0
|
||||||
@@ -186,8 +185,8 @@ export const getStaticProps: GetStaticProps<Props> = async ctx => {
|
|||||||
person: 'Тимашева Марина Геннадьевна',
|
person: 'Тимашева Марина Геннадьевна',
|
||||||
position: 'Директор',
|
position: 'Директор',
|
||||||
signature: '0ac4ea89753a4ba9893799442325fb41',
|
signature: '0ac4ea89753a4ba9893799442325fb41',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const App: React.FC<IAppProps> = ({ showAuthor = false, menu, ...props })
|
|||||||
const hideBreadcrumbs = useMobile()
|
const hideBreadcrumbs = useMobile()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const blockStyle = {
|
const blockStyle = {
|
||||||
justifyContent: 'center'
|
justifyContent: 'center',
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export const FileCard: React.FC<FileCardProps> = props => {
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
src={props.image_url}
|
src={props.image_url}
|
||||||
|
alt={''}
|
||||||
width={100}
|
width={100}
|
||||||
height={100}
|
height={100}
|
||||||
objectFit={'contain'}
|
objectFit={'contain'}
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ export const Html: React.FC<HtmlProps> = ({ as = 'div', ...props }) => {
|
|||||||
className: props.className,
|
className: props.className,
|
||||||
dangerouslySetInnerHTML: {
|
dangerouslySetInnerHTML: {
|
||||||
__html: props.html,
|
__html: props.html,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ export const MenuItem: React.FC<MenuItemProps> = props => {
|
|||||||
<ActiveLink
|
<ActiveLink
|
||||||
href={href}
|
href={href}
|
||||||
activeStyle={{
|
activeStyle={{
|
||||||
fontWeight: 'bold'
|
fontWeight: 'bold',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export const Navigation: React.FC<INavigationProps> = props => {
|
|||||||
open={open}
|
open={open}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
style={{
|
style={{
|
||||||
margin: 'var(--size-xs)'
|
margin: 'var(--size-xs)',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Block>
|
</Block>
|
||||||
@@ -59,18 +59,18 @@ export const Navigation: React.FC<INavigationProps> = props => {
|
|||||||
open={open}
|
open={open}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
style={{
|
style={{
|
||||||
margin: 'var(--size-xs)'
|
margin: 'var(--size-xs)',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Block>
|
</Block>
|
||||||
) : (
|
) : (
|
||||||
<nav style={props.style}>
|
<nav style={props.style}>
|
||||||
<Menu
|
<Menu
|
||||||
layout={'desktop'}
|
layout={'desktop'}
|
||||||
items={menu}
|
items={menu}
|
||||||
/>
|
/>
|
||||||
</nav>
|
</nav>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -7,5 +7,5 @@ export type SpacerProps = {
|
|||||||
export const Spacer: React.FC<SpacerProps> = ({ as = 'div' }) => createElement(as, {
|
export const Spacer: React.FC<SpacerProps> = ({ as = 'div' }) => createElement(as, {
|
||||||
style: {
|
style: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
+5
-5
@@ -27,13 +27,13 @@ const config = {
|
|||||||
{
|
{
|
||||||
type: 'link',
|
type: 'link',
|
||||||
value: 'https://vk.com/shlisselburghudozka',
|
value: 'https://vk.com/shlisselburghudozka',
|
||||||
title: 'Вконтакте'
|
title: 'Вконтакте',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'link',
|
type: 'link',
|
||||||
value: 'https://www.instagram.com/hudozka',
|
value: 'https://www.instagram.com/hudozka',
|
||||||
title: 'Инстаграм'
|
title: 'Инстаграм',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
menu: [
|
menu: [
|
||||||
{
|
{
|
||||||
@@ -67,8 +67,8 @@ const config = {
|
|||||||
{
|
{
|
||||||
name: 'Дистанционное образование',
|
name: 'Дистанционное образование',
|
||||||
href: '/info/online-education',
|
href: '/info/online-education',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
export default config
|
export default config
|
||||||
+1
-1
@@ -10,6 +10,6 @@ import { ru } from 'date-fns/locale'
|
|||||||
export const dateFormat = (date: string | Date) => {
|
export const dateFormat = (date: string | Date) => {
|
||||||
const value = typeof date === 'string' ? new Date(date) : date
|
const value = typeof date === 'string' ? new Date(date) : date
|
||||||
return format(value, "d MMMM yyyy", {
|
return format(value, "d MMMM yyyy", {
|
||||||
locale: ru
|
locale: ru,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
export function titleCase(str: string) {
|
export function titleCase(str: string) {
|
||||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||||
}
|
}
|
||||||
+1
-1
@@ -15,7 +15,7 @@ export interface IResponseItems<T> {
|
|||||||
export function wrapInitialProps(fn: (ctx: NextPageContext) => void) {
|
export function wrapInitialProps(fn: (ctx: NextPageContext) => void) {
|
||||||
return async (ctx: NextPageContext) => {
|
return async (ctx: NextPageContext) => {
|
||||||
if (process.env.NODE_ENV === 'production' && process.browser) {
|
if (process.env.NODE_ENV === 'production' && process.browser) {
|
||||||
return window['__NEXT_DATA__'].props.pageProps;
|
return window['__NEXT_DATA__'].props.pageProps
|
||||||
}
|
}
|
||||||
|
|
||||||
return fn(ctx)
|
return fn(ctx)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { IMenu, IPage, ITag, PageCardDto, Pic, Token } from "@/types";
|
import { IMenu, IPage, ITag, PageCardDto, Pic, Token } from "@/types"
|
||||||
import { asItem } from "./lib";
|
import { asItem } from "./lib"
|
||||||
import { StrapiComponentEmbed, StrapiComponent, StrapiHome, StrapiPage, StrapiPageCard, StrapiTag, StrapiMedia, StrapiMenu } from "./types";
|
import { StrapiComponentEmbed, StrapiComponent, StrapiHome, StrapiPage, StrapiPageCard, StrapiTag, StrapiMedia, StrapiMenu } from "./types"
|
||||||
import { typograf, markdownToHtml } from 'src/lib/text'
|
import { typograf, markdownToHtml } from 'src/lib/text'
|
||||||
import { encodeImageToBlurhash } from "./image";
|
import { encodeImageToBlurhash } from "./image"
|
||||||
|
|
||||||
const md = (text: string) => typograf(markdownToHtml(text))
|
const md = (text: string) => typograf(markdownToHtml(text))
|
||||||
|
|
||||||
@@ -22,13 +22,13 @@ export function createEmbed(component: StrapiComponentEmbed): Token {
|
|||||||
token: 'youtube',
|
token: 'youtube',
|
||||||
data: {
|
data: {
|
||||||
url: component.src,
|
url: component.src,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
token: 'html',
|
token: 'html',
|
||||||
data: `<iframe src="${component.src}" width="100%" height="480" frameborder="0"></iframe>`
|
data: `<iframe src="${component.src}" width="100%" height="480" frameborder="0"></iframe>`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ export async function createPageToken(component: StrapiComponent): Promise<Token
|
|||||||
file_size: component.media.size * 1000,
|
file_size: component.media.size * 1000,
|
||||||
// file_size: component.media.size,
|
// file_size: component.media.size,
|
||||||
file_format: component.media.mime,
|
file_format: component.media.mime,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ export async function createPageToken(component: StrapiComponent): Promise<Token
|
|||||||
token: 'grid',
|
token: 'grid',
|
||||||
data: {
|
data: {
|
||||||
items,
|
items,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user