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