Skip to content

Commit

Permalink
refactor: improve last updated styles for mobile devices (#2073)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiner-tang authored Apr 17, 2024
1 parent 6072519 commit e3ce9b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/client/theme-default/slots/ContentFooter/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@

dd {
margin: 0;
@media @mobile {
.dumi-default-mobile-hidden {
display: none;
}
}

svg {
margin-inline-end: 4px;
Expand Down
8 changes: 5 additions & 3 deletions src/client/theme-default/slots/ContentFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ContentFooter: FC = () => {
const { frontmatter } = useRouteMeta();
const intl = useIntl();
const [prev, setPrev] = useState<
typeof sidebar[0]['children'][0] | undefined
(typeof sidebar)[0]['children'][0] | undefined
>(undefined);
const [next, setNext] = useState<typeof prev>(undefined);
const [isoLastUpdated, setIsoLastUpdated] = useState('');
Expand All @@ -31,7 +31,7 @@ const ContentFooter: FC = () => {
// calculate the previous and next page
useLayoutEffect(() => {
if (sidebar) {
const items = sidebar.reduce<typeof sidebar[0]['children']>(
const items = sidebar.reduce<(typeof sidebar)[0]['children']>(
(ret, group) => ret.concat(group.children),
[],
);
Expand Down Expand Up @@ -61,7 +61,9 @@ const ContentFooter: FC = () => {
{showLastUpdated && (
<dd>
<IconClock />
<FormattedMessage id="content.footer.last.updated" />
<span className="dumi-default-mobile-hidden">
<FormattedMessage id="content.footer.last.updated" />
</span>
<time dateTime={isoLastUpdated}>{lastUpdated}</time>
</dd>
)}
Expand Down

0 comments on commit e3ce9b4

Please sign in to comment.