Merge branch 'custom-css'

This commit is contained in:
Athou
2025-05-07 19:44:24 +02:00
12 changed files with 33 additions and 23 deletions

View File

@@ -29,7 +29,7 @@ export const ActionButton = forwardRef<HTMLDivElement, ActionButtonProps>((props
const iconOnly = (mobile && !props.showLabelOnMobile) || (!mobile && props.hideLabelOnDesktop) const iconOnly = (mobile && !props.showLabelOnMobile) || (!mobile && props.hideLabelOnDesktop)
return ( return (
<Box ref={ref}> <Box ref={ref} className="cf-action-button">
{iconOnly && ( {iconOnly && (
<Tooltip label={label} openDelay={Constants.tooltip.delay}> <Tooltip label={label} openDelay={Constants.tooltip.delay}>
<ActionIcon <ActionIcon

View File

@@ -288,7 +288,7 @@ export function FeedEntries() {
return ( return (
<InfiniteScroll <InfiniteScroll
id="entries" id="entries"
className={`view-mode-${viewMode}`} className={`cf-entries cf-view-mode-${viewMode}`}
initialLoad={false} initialLoad={false}
loadMore={async () => await (!loading && dispatch(loadMoreEntries()))} loadMore={async () => await (!loading && dispatch(loadMoreEntries()))}
hasMore={hasMore} hasMore={hasMore}

View File

@@ -184,10 +184,10 @@ export function FeedEntry(props: FeedEntryProps) {
</a> </a>
{props.expanded && ( {props.expanded && (
<Box px={paddingX} pb={paddingY} onClick={props.onBodyClick}> <Box px={paddingX} pb={paddingY} onClick={props.onBodyClick}>
<Box className={classes.body}> <Box className={`${classes.body} cf-content`}>
<FeedEntryBody entry={props.entry} /> <FeedEntryBody entry={props.entry} />
</Box> </Box>
<Divider variant="dashed" my={paddingY} /> <Divider variant="dashed" my={paddingY} className="cf-footer-divider" />
<FeedEntryFooter entry={props.entry} /> <FeedEntryFooter entry={props.entry} />
</Box> </Box>
)} )}

View File

@@ -37,7 +37,7 @@ export function FeedEntryFooter(props: FeedEntryFooterProps) {
) )
return ( return (
<Group justify="space-between"> <Group justify="space-between" className="cf-footer">
<Group gap={spacing}> <Group gap={spacing}>
{props.entry.markable && ( {props.entry.markable && (
<ActionButton <ActionButton

View File

@@ -29,8 +29,8 @@ export function FeedEntryHeader(props: FeedEntryHeaderProps) {
read: props.entry.read, read: props.entry.read,
}) })
return ( return (
<Box> <Box className="cf-header">
<Flex align="flex-start" justify="space-between"> <Flex align="flex-start" justify="space-between" className="cf-header-title">
<Flex align="flex-start" className={classes.main}> <Flex align="flex-start" className={classes.main}>
{props.showStarIcon && ( {props.showStarIcon && (
<Box ml={-5}> <Box ml={-5}>
@@ -41,7 +41,7 @@ export function FeedEntryHeader(props: FeedEntryHeaderProps) {
</Flex> </Flex>
{props.showExternalLinkIcon && <OpenExternalLink entry={props.entry} />} {props.showExternalLinkIcon && <OpenExternalLink entry={props.entry} />}
</Flex> </Flex>
<Flex align="center"> <Flex align="center" className="cf-header-subtitle">
<FeedFavicon url={props.entry.iconUrl} /> <FeedFavicon url={props.entry.iconUrl} />
<Space w={6} /> <Space w={6} />
<Box c="dimmed"> <Box c="dimmed">
@@ -51,7 +51,7 @@ export function FeedEntryHeader(props: FeedEntryHeaderProps) {
</Box> </Box>
</Flex> </Flex>
{props.expanded && ( {props.expanded && (
<Box c="dimmed"> <Box className="cf-header-details">
{props.entry.author && <span>by {props.entry.author}</span>} {props.entry.author && <span>by {props.entry.author}</span>}
{props.entry.author && props.entry.categories && <span>&nbsp;·&nbsp;</span>} {props.entry.author && props.entry.categories && <span>&nbsp;·&nbsp;</span>}
{props.entry.categories && <span>{props.entry.categories}</span>} {props.entry.categories && <span>{props.entry.categories}</span>}

View File

@@ -42,11 +42,14 @@ function HeaderToolbar(props: { children: React.ReactNode }) {
display: "flex", display: "flex",
justifyContent: "space-between", justifyContent: "space-between",
}} }}
className="cf-toolbar"
> >
{props.children} {props.children}
</Box> </Box>
) : ( ) : (
<Group gap={spacing}>{props.children}</Group> <Group gap={spacing} className="cf-toolbar">
{props.children}
</Group>
) )
} }
@@ -75,7 +78,7 @@ export function Header() {
if (!settings) return <Loader /> if (!settings) return <Loader />
return ( return (
<Center> <Center className="cf-toolbar-wrapper">
<HeaderToolbar> <HeaderToolbar>
<ActionButton <ActionButton
icon={<TbArrowUp size={iconSize} />} icon={<TbArrowUp size={iconSize} />}

View File

@@ -182,7 +182,7 @@ export function Tree() {
<OnDesktop> <OnDesktop>
<TreeSearch feeds={feeds} /> <TreeSearch feeds={feeds} />
</OnDesktop> </OnDesktop>
<Box> <Box className="cf-tree">
{allCategoryNode()} {allCategoryNode()}
{starredCategoryNode()} {starredCategoryNode()}
{root.children.map(c => recursiveCategoryNode(c))} {root.children.map(c => recursiveCategoryNode(c))}

View File

@@ -68,18 +68,18 @@ export function TreeNode(props: TreeNodeProps) {
<Box <Box
py={1} py={1}
pl={props.level * 20} pl={props.level * 20}
className={classes.node} className={`${classes.node} cf-treenode cf-treenode-${props.type}`}
onClick={(e: React.MouseEvent) => props.onClick(e, props.id)} onClick={(e: React.MouseEvent) => props.onClick(e, props.id)}
data-id={props.id} data-id={props.id}
data-type={props.type} data-type={props.type}
data-unread-count={props.unread} data-unread-count={props.unread}
> >
<Box mr={6} onClick={(e: React.MouseEvent) => props.onIconClick?.(e, props.id)}> <Box mr={6} onClick={(e: React.MouseEvent) => props.onIconClick?.(e, props.id)} className="cf-treenode-icon">
<Center>{typeof props.icon === "string" ? <FeedFavicon url={props.icon} /> : props.icon}</Center> <Center>{typeof props.icon === "string" ? <FeedFavicon url={props.icon} /> : props.icon}</Center>
</Box> </Box>
<Box className={classes.nodeText}>{props.name}</Box> <Box className={classes.nodeText}>{props.name}</Box>
{!props.expanded && ( {!props.expanded && (
<Box> <Box className="cf-treenode-unread-count">
<UnreadCount unreadCount={props.unread} /> <UnreadCount unreadCount={props.unread} />
</Box> </Box>
)} )}

View File

@@ -1,7 +1,7 @@
import { msg } from "@lingui/core/macro" import { msg } from "@lingui/core/macro"
import { useLingui } from "@lingui/react" import { useLingui } from "@lingui/react"
import { Trans } from "@lingui/react/macro" import { Trans } from "@lingui/react/macro"
import { TextInput } from "@mantine/core" import { Box, TextInput } from "@mantine/core"
import { Spotlight, type SpotlightActionData, spotlight } from "@mantine/spotlight" import { Spotlight, type SpotlightActionData, spotlight } from "@mantine/spotlight"
import { redirectToFeed } from "app/redirect/thunks" import { redirectToFeed } from "app/redirect/thunks"
import { useAppDispatch } from "app/store" import { useAppDispatch } from "app/store"
@@ -33,7 +33,7 @@ export function TreeSearch(props: TreeSearchProps) {
useMousetrap("g u", () => spotlight.open()) useMousetrap("g u", () => spotlight.open())
return ( return (
<> <Box className="cf-treesearch">
<TextInput <TextInput
placeholder={_(msg`Search`)} placeholder={_(msg`Search`)}
leftSection={searchIcon} leftSection={searchIcon}
@@ -58,6 +58,6 @@ export function TreeSearch(props: TreeSearchProps) {
}} }}
nothingFound={<Trans>Nothing found</Trans>} nothingFound={<Trans>Nothing found</Trans>}
/> />
</> </Box>
) )
} }

View File

@@ -18,7 +18,7 @@ export function UnreadCount(props: { unreadCount: number }) {
const count = props.unreadCount >= 10000 ? "10k+" : props.unreadCount const count = props.unreadCount >= 10000 ? "10k+" : props.unreadCount
return ( return (
<Tooltip label={props.unreadCount} disabled={props.unreadCount === count} openDelay={Constants.tooltip.delay}> <Tooltip label={props.unreadCount} disabled={props.unreadCount === count} openDelay={Constants.tooltip.delay}>
<Badge className={classes.badge} variant="light" fullWidth> <Badge className={`${classes.badge} cf-badge`} variant="light" fullWidth>
{count} {count}
</Badge> </Badge>
</Tooltip> </Tooltip>

View File

@@ -88,7 +88,7 @@ export function FeedEntriesPage(props: FeedEntriesPageProps) {
return ( return (
// add some room at the bottom of the page in order to be able to scroll the current entry at the top of the page when expanding // add some room at the bottom of the page in order to be able to scroll the current entry at the top of the page when expanding
<Box mb={viewport.height * 0.7}> <Box mb={viewport.height * 0.7}>
<Group gap="xl"> <Group gap="xl" className="cf-entries-title">
{sourceWebsiteUrl && ( {sourceWebsiteUrl && (
<a href={sourceWebsiteUrl} target="_blank" rel="noreferrer" className={classes.sourceWebsiteLink}> <a href={sourceWebsiteUrl} target="_blank" rel="noreferrer" className={classes.sourceWebsiteLink}>
<Title order={3}>{title}</Title> <Title order={3}>{title}</Title>

View File

@@ -35,9 +35,16 @@ interface LayoutProps {
function LogoAndTitle() { function LogoAndTitle() {
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
return ( return (
<Center inline onClick={async () => await dispatch(redirectToRootCategory())} style={{ cursor: "pointer" }}> <Center
className="cf-logo-title"
inline
onClick={async () => await dispatch(redirectToRootCategory())}
style={{ cursor: "pointer" }}
>
<Box className="cf-logo">
<Logo size={24} /> <Logo size={24} />
<Title order={3} pl="md"> </Box>
<Title order={3} pl="md" className="cf-title">
CommaFeed CommaFeed
</Title> </Title>
</Center> </Center>