Skip to content

Commit

Permalink
feat(DocPage): new design
Browse files Browse the repository at this point in the history
  • Loading branch information
Feverqwe committed Jan 16, 2024
1 parent 48b497f commit 241360e
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 15 deletions.
5 changes: 2 additions & 3 deletions src/components/ContributorAvatars/ContributorAvatars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ const ContributorAvatars: React.FC<ContributorAvatarsProps> = (props) => {
return null;
}

if (contributors.length === 1) {
const oneAvatar = getOneAvatar(contributors[0], isAuthor, onlyAuthor);
return oneAvatar;
if (isAuthor && contributors.length === 1) {
return getOneAvatar(contributors[0], isAuthor, onlyAuthor);
}

const displayedContributors = [...contributors];
Expand Down
2 changes: 1 addition & 1 deletion src/components/DocPage/DocPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
}

&__separator {
margin: 0 5px 32px 0;
margin: 0 20px 32px 0;
align-self: center;
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/DocPage/DocPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,16 +383,16 @@ class DocPage extends React.Component<DocPageInnerProps, DocPageState> {
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 (
<div className={b('page-contributors')}>
{[updatedAt, author, contributors].filter(Boolean).map((element, idx, arr) => (
{[author, contributors, updatedAt].filter(Boolean).map((element, idx, arr) => (
<Fragment key={idx}>
{element}
{arr.length - 1 !== idx && <div className={b('separator')}>{','}</div>}
{arr.length - 1 !== idx && <div className={b('separator')} />}
</Fragment>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/UpdatedAtDate/UpdatedAtDate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const UpdatedAtDate: React.FC<UpdatedAtDateProps> = ({updatedAt}) => {

const updatedAtFormatted = useMemo(() => {
const {localeCode} = getConfig();
return format(updatedAt, 'longDateTime', localeCode);
return format(updatedAt, 'longDate', localeCode);
}, [updatedAt]);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"title": "Written by"
},
"contributors": {
"title": "improved by"
"title": "Improved by"
},
"feedback": {
"like-text": "Helpful",
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"title": "Статья создана"
},
"contributors": {
"title": "улучшена"
"title": "Улучшена"
},
"feedback": {
"like-text": "Статья полезна",
Expand Down
6 changes: 1 addition & 5 deletions src/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
};

0 comments on commit 241360e

Please sign in to comment.