Hide changelog versions on medium screen

This commit is contained in:
Misode
2022-07-02 02:06:29 +02:00
parent 231b032029
commit b09ed80d20
2 changed files with 6 additions and 3 deletions

View File

@@ -5,11 +5,12 @@ import { Badge } from './index.js'
type Props = {
change: Change,
minimal?: boolean,
activeTags?: string[],
toggleTag?: (tag: string) => unknown,
}
export function ChangelogEntry({ change, activeTags, toggleTag }: Props) {
return <Card overlay={<>
export function ChangelogEntry({ change, minimal, activeTags, toggleTag }: Props) {
return <Card overlay={!minimal && <>
<a class="changelog-version" href={`/versions/?id=${change.version}`}>{change.version}</a>
<a class="changelog-version" href={`/versions/?id=${change.group}`}>{change.group}</a>
</>}>

View File

@@ -116,10 +116,12 @@ function Versions() {
function Changelog() {
const { locale } = useLocale()
const hugeScreen = useMediaQuery('(min-width: 960px)')
const { value: changes } = useAsync(fetchChangelogs, [])
const latestChanges = useMemo(() => changes?.sort((a, b) => b.order - a.order).slice(0, 2), [changes])
return <ToolGroup title={locale('changelog')} link="/changelog/" titleIcon="git_commit">
{latestChanges?.map(change => <ChangelogEntry change={change} />)}
{latestChanges?.map(change => <ChangelogEntry minimal={!hugeScreen} change={change} />)}
</ToolGroup>
}