diff --git a/components/NotionTypes/Callout/Callout.jsx b/components/NotionTypes/Callout/Callout.jsx index b4d4d51f..a708525a 100644 --- a/components/NotionTypes/Callout/Callout.jsx +++ b/components/NotionTypes/Callout/Callout.jsx @@ -1,10 +1,8 @@ import React from 'react' import Image from 'next/image' - -import { getTextContent } from '../../../utils/textParser' - +import { getTextContent } from '../../../utils/getNotionContentItems' +import { getNotionColor } from '../../../utils/getNotionColor' import styles from './Callout.module.css' -import { getNotionColor } from '../../../utils/colors' export const Callout = ({ columnItem }) => { const iconUrl = columnItem?.content?.icon?.external?.url diff --git a/components/NotionTypes/Headings/Headings.jsx b/components/NotionTypes/Headings/Headings.jsx index db572b5a..fbd47471 100644 --- a/components/NotionTypes/Headings/Headings.jsx +++ b/components/NotionTypes/Headings/Headings.jsx @@ -1,7 +1,5 @@ import React from 'react' - -import { getHeaderContent } from '../../../utils/textParser' - +import { getHeaderContent } from '../../../utils/getNotionContentItems' import styles from './Headings.module.css' export function H1({ columnItem }) { diff --git a/components/NotionTypes/Lists/Ordered/Ordered.jsx b/components/NotionTypes/Lists/Ordered/Ordered.jsx index 24b9cb18..f7f72867 100644 --- a/components/NotionTypes/Lists/Ordered/Ordered.jsx +++ b/components/NotionTypes/Lists/Ordered/Ordered.jsx @@ -1,6 +1,5 @@ import React from 'react' - -import { getTextContent } from '../../../../utils/textParser' +import { getTextContent } from '../../../../utils/getNotionContentItems' import styles from './ordered.module.css' export function OrderedList({ columnItem }) { diff --git a/components/NotionTypes/Lists/Unordered/Unordered.jsx b/components/NotionTypes/Lists/Unordered/Unordered.jsx index 2a5b376c..39a1e70a 100644 --- a/components/NotionTypes/Lists/Unordered/Unordered.jsx +++ b/components/NotionTypes/Lists/Unordered/Unordered.jsx @@ -1,5 +1,5 @@ import React from 'react' -import { getTextContent } from '../../../../utils/textParser' +import { getTextContent } from '../../../../utils/getNotionContentItems' import styles from './unordered.module.css' function UnorderedList({ columnItem }) { diff --git a/components/NotionTypes/Text/Code/Code.jsx b/components/NotionTypes/Text/Code/Code.jsx index 51a903bb..8a294ced 100644 --- a/components/NotionTypes/Text/Code/Code.jsx +++ b/components/NotionTypes/Text/Code/Code.jsx @@ -1,6 +1,4 @@ import React from 'react' - -// import getTextContent from '../../../../utils/notionTypeParser/textParser' import styles from './code.module.css' export default function Code({ columnItem }) { diff --git a/components/NotionTypes/Text/Paragraph/Paragraph.jsx b/components/NotionTypes/Text/Paragraph/Paragraph.jsx index 67441242..a0190c64 100644 --- a/components/NotionTypes/Text/Paragraph/Paragraph.jsx +++ b/components/NotionTypes/Text/Paragraph/Paragraph.jsx @@ -1,7 +1,6 @@ import React from 'react' - +import { getTextContent } from '../../../../utils/getNotionContentItems' import styles from './paragraph.module.css' -import { getTextContent } from '../../../../utils/textParser' function Paragraph({ columnItem }) { const textContent = getTextContent(columnItem, true) diff --git a/pages/_app.jsx b/pages/_app.jsx index 444eb2ba..16dfb68a 100644 --- a/pages/_app.jsx +++ b/pages/_app.jsx @@ -1,6 +1,6 @@ import { createContext } from 'react' import Head from 'next/head' -import { isetSansFont } from '../utils/font' +import { IsetSans } from '../styles/fonts/IsetSans' import '../styles/globals.css' import 'ekb/style.css' @@ -15,7 +15,7 @@ function MyApp({ Component, pageProps }) { Городские руководства -
+
diff --git a/pages/index.jsx b/pages/index.jsx index b144e37a..86a6571b 100644 --- a/pages/index.jsx +++ b/pages/index.jsx @@ -1,6 +1,6 @@ import React from 'react' import { getTree } from '../api/apiPage' -import parseManualsPreview from '../utils/manualsPreviewParser' +import getManualsPreviews from '../utils/getManualsPreviews' import MainPage from '../components/MainPage/MainPage' export default function Home({ manualsPreview }) { @@ -12,7 +12,7 @@ export async function getServerSideProps() { return { props: { - manualsPreview: parseManualsPreview(tree), + manualsPreview: getManualsPreviews(tree), }, } } diff --git a/styles/fonts/IsetSans.js b/styles/fonts/IsetSans.js new file mode 100644 index 00000000..2e2346ec --- /dev/null +++ b/styles/fonts/IsetSans.js @@ -0,0 +1,27 @@ +import localFont from 'next/font/local' + +export const IsetSans = localFont({ + src: [ + { + path: 'IsetSans-Light.woff2', + weight: '300', + }, + { + path: 'IsetSans-Medium.woff2', + weight: '500', + }, + { + path: 'IsetSans-SemiBold.woff2', + weight: '600', + }, + { + path: 'IsetSans-Regular.woff2', + weight: '400', + }, + { + path: 'IsetSans-Regular-Italic.woff2', + weight: '400', + style: 'italic', + }, + ], +}) diff --git a/utils/font.js b/utils/font.js deleted file mode 100644 index 76edce38..00000000 --- a/utils/font.js +++ /dev/null @@ -1,27 +0,0 @@ -import localFont from 'next/font/local' - -export const isetSansFont = localFont({ - src: [ - { - path: '../styles/fonts/IsetSans-Light.woff2', - weight: '300', - }, - { - path: '../styles/fonts/IsetSans-Medium.woff2', - weight: '500', - }, - { - path: '../styles/fonts/IsetSans-SemiBold.woff2', - weight: '600', - }, - { - path: '../styles/fonts/IsetSans-Regular.woff2', - weight: '400', - }, - { - path: '../styles/fonts/IsetSans-Regular-Italic.woff2', - weight: '400', - style: 'italic', - }, - ], -}) diff --git a/utils/getAllUrls.js b/utils/getAllUrls.js deleted file mode 100644 index 4f18f5d6..00000000 --- a/utils/getAllUrls.js +++ /dev/null @@ -1,15 +0,0 @@ -const getAllUrls = (children, path = []) => { - let urls = [] - for (const child of children) { - const curUrl = child.properties.pageUrl.url - const curPath = [...path, curUrl] - urls.push(curPath) - - const childUrls = getAllUrls(child.children, curPath) - urls = [...urls, ...childUrls] - } - - return urls -} - -export default getAllUrls diff --git a/utils/manualsPreviewParser.js b/utils/getManualsPreviews.js similarity index 95% rename from utils/manualsPreviewParser.js rename to utils/getManualsPreviews.js index 695a77af..802f7b16 100644 --- a/utils/manualsPreviewParser.js +++ b/utils/getManualsPreviews.js @@ -2,7 +2,7 @@ import t from './typograf' import { MANUALS_HIDDEN } from '../consts/manuals' import { API_HOST } from '../consts/endpoints' -function parseManualsPreview(tree) { +function getManualsPreviews(tree) { // TODO Remove hard-code after back-end feature https://github.com/ekaterinburgdev/guides-api/issues/10 const manualsVisible = tree.children.filter((manual) => { return !MANUALS_HIDDEN.includes(manual?.properties?.pageUrl?.url) @@ -39,4 +39,4 @@ function parseManualsPreview(tree) { }) } -export default parseManualsPreview +export default getManualsPreviews diff --git a/utils/colors.js b/utils/getNotionColor.js similarity index 100% rename from utils/colors.js rename to utils/getNotionColor.js diff --git a/utils/textParser.jsx b/utils/getNotionContentItems.js similarity index 97% rename from utils/textParser.jsx rename to utils/getNotionContentItems.js index 8211628c..3897e208 100644 --- a/utils/textParser.jsx +++ b/utils/getNotionContentItems.js @@ -1,8 +1,6 @@ import React from 'react' - -import { getNotionColor } from './colors' - import t from './typograf' +import { getNotionColor } from './getNotionColor' export const getHeaderContent = (item) => item.content.text.map((par) => {