-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: archived articles virtual scrolling (#1077)
- Loading branch information
Showing
6 changed files
with
111 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import styled, { type CSSObject } from "@emotion/styled"; | ||
import { type CardProps } from "@mui/material/Card"; | ||
import { alpha } from "@mui/material/styles"; | ||
import { graphql } from "gatsby"; | ||
|
||
import { TimelineCardBase } from "../Timeline/TimelineCardBase"; | ||
|
||
import { QiitaIcon } from "@/components/icons/QiitaIcon"; | ||
import { type TimelineItemCardFragment } from "@/generated/graphqlTypes"; | ||
import { type M3ColorTokens, outputColorTokens } from "@/layouts/themes"; | ||
|
||
export const query = graphql` | ||
fragment TimelineItemCard on QiitaJson { | ||
title | ||
url | ||
} | ||
`; | ||
|
||
const adoptColorTokens = (colorTokens: M3ColorTokens): CSSObject => { | ||
const background = colorTokens.surfaceVariant; | ||
const color = colorTokens.onSurface; | ||
|
||
return { | ||
background, | ||
color, | ||
"&:hover": { | ||
background: alpha(background, 0.8), | ||
}, | ||
}; | ||
}; | ||
|
||
const StyledTimelineCard = styled(TimelineCardBase)(({ theme }) => { | ||
return { | ||
...adoptColorTokens(outputColorTokens.lightColorTokens), | ||
[theme.getColorSchemeSelector("dark")]: adoptColorTokens( | ||
outputColorTokens.darkColorTokens, | ||
), | ||
}; | ||
}); | ||
|
||
export type TimelineItemCardProps = { | ||
item: TimelineItemCardFragment; | ||
} & CardProps; | ||
|
||
export const TimelineItemCard = ({ | ||
item, | ||
...props | ||
}: TimelineItemCardProps): JSX.Element => { | ||
return ( | ||
<StyledTimelineCard | ||
avatar={<QiitaIcon aria-hidden="true" />} | ||
title={item.title} | ||
url={item.url} | ||
{...props} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters