From bde8e24a2a275fa48b0518373aedcc32bb2685c7 Mon Sep 17 00:00:00 2001 From: Anton Vikulov Date: Tue, 16 Jan 2024 21:00:37 +0500 Subject: [PATCH] feat(DocPage): new design --- src/components/DocPage/DocPage.scss | 2 +- src/components/DocPage/DocPage.tsx | 6 +++--- src/components/UpdatedAtDate/UpdatedAtDate.tsx | 2 +- src/i18n/en.json | 2 +- src/i18n/ru.json | 2 +- src/utils/date.ts | 6 +----- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/components/DocPage/DocPage.scss b/src/components/DocPage/DocPage.scss index 036c016b..b6540025 100644 --- a/src/components/DocPage/DocPage.scss +++ b/src/components/DocPage/DocPage.scss @@ -235,7 +235,7 @@ } &__separator { - margin: 0 5px 32px 0; + margin: 0 24px 32px 0; align-self: center; } diff --git a/src/components/DocPage/DocPage.tsx b/src/components/DocPage/DocPage.tsx index b2615fc3..553bc28e 100644 --- a/src/components/DocPage/DocPage.tsx +++ b/src/components/DocPage/DocPage.tsx @@ -383,16 +383,16 @@ class DocPage extends React.Component { return null; } - const updatedAt = this.renderUpdatedAt(meta?.updatedAt); const author = this.renderAuthor(!meta?.contributors?.length); const contributors = this.renderContributors(); + const updatedAt = this.renderUpdatedAt(meta?.updatedAt); return (
- {[updatedAt, author, contributors].filter(Boolean).map((element, idx, arr) => ( + {[author, contributors, updatedAt].filter(Boolean).map((element, idx, arr) => ( {element} - {arr.length - 1 !== idx &&
{','}
} + {arr.length - 1 !== idx &&
} ))}
diff --git a/src/components/UpdatedAtDate/UpdatedAtDate.tsx b/src/components/UpdatedAtDate/UpdatedAtDate.tsx index 682cb956..1ee4a5a1 100644 --- a/src/components/UpdatedAtDate/UpdatedAtDate.tsx +++ b/src/components/UpdatedAtDate/UpdatedAtDate.tsx @@ -19,7 +19,7 @@ const UpdatedAtDate: React.FC = ({updatedAt}) => { const updatedAtFormatted = useMemo(() => { const {localeCode} = getConfig(); - return format(updatedAt, 'longDateTime', localeCode); + return format(updatedAt, 'longDate', localeCode); }, [updatedAt]); return ( diff --git a/src/i18n/en.json b/src/i18n/en.json index 92244c5a..35bcbcb1 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -57,7 +57,7 @@ "title": "Written by" }, "contributors": { - "title": "improved by" + "title": "Improved by" }, "feedback": { "like-text": "Helpful", diff --git a/src/i18n/ru.json b/src/i18n/ru.json index fefa9d35..f69c93dd 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -57,7 +57,7 @@ "title": "Статья создана" }, "contributors": { - "title": "улучшена" + "title": "Улучшена" }, "feedback": { "like-text": "Статья полезна", diff --git a/src/utils/date.ts b/src/utils/date.ts index 3b4a29a2..b295b5dd 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -73,9 +73,5 @@ export const format = ( formatCode: keyof DateTimeFormatter, localeCode = defaultRegion, ) => { - let result = getDateTimeFormatter(localeCode)[formatCode].format(new Date(date)); - if (formatCode === 'longDate' && ['ru-RU', 'ru-KZ'].includes(localeCode)) { - result = result.replace(/\sг\.$/, ''); - } - return result; + return getDateTimeFormatter(localeCode)[formatCode].format(new Date(date)); };