Skip to content

Commit

Permalink
fix cards display on compact mode
Browse files Browse the repository at this point in the history
  • Loading branch information
medyo committed Dec 26, 2023
1 parent a7c98e9 commit e71c580
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
16 changes: 14 additions & 2 deletions src/assets/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -431,20 +431,32 @@ a {
background-color: var(--placeholder-background-color);
margin-bottom: 12px;
}

.rowTitle {
color: var(--primary-text-color);
margin: 0;
padding: 0;
font-size: 16px;
text-decoration: none;
display: block;
display: flex;
flex-direction: row;
}
.rowLink {
color: var(--primary-text-color);
margin: 0;
padding: 0;
font-size: 16px;
text-decoration: none;
display: flex;
flex-direction: row;
}

.rowTitle:hover {
color: var(--primary-hover-text-color);
}

.titleWithCover {
display: block;
}
.dark .blockHeaderWhite {
color: white;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Elements/CardLink/CardLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const CardLink = ({
return (
<ClickableItem
link={link}
className={'rowTitle' + (className ? ` ${className}` : '')}
className={'rowLink' + (className ? ` ${className}` : '')}
analyticsAttributes={analyticsAttributes}
appendRef={appendRef}>
{children}
Expand Down
5 changes: 5 additions & 0 deletions src/features/cards/components/aiCard/AICard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export function AICard({ meta, withAds }: CardPropsType) {
error,
} = useGetAIArticles({
userTopics: userSelectedTags.map((tag) => tag.label.toLocaleLowerCase()),
config: {
cacheTime: 0,
staleTime: 0,
useErrorBoundary: false,
},
})

const renderItem = (item: Article, index: number) => (
Expand Down
9 changes: 1 addition & 8 deletions src/features/cards/components/aiCard/ArticleItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { BiCommentDetail } from 'react-icons/bi'
import { GoDotFill } from 'react-icons/go'
import { MdAccessTime } from 'react-icons/md'
import { VscTriangleUp } from 'react-icons/vsc'
import { CardItemWithActions, CardLink, ClickableItem } from 'src/components/Elements'
import { Attributes } from 'src/lib/analytics'
import { useUserPreferences } from 'src/stores/preferences'
Expand All @@ -23,6 +22,7 @@ const ArticleItem = (props: BaseItemPropsType<Article>) => {
<p className="rowTitle">
<CardLink
link={item.url}
className="titleWithCover"
analyticsAttributes={{
[Attributes.POINTS]: item.reactions,
[Attributes.TRIGERED_FROM]: 'card',
Expand All @@ -33,13 +33,6 @@ const ArticleItem = (props: BaseItemPropsType<Article>) => {
{item.image_url && listingMode === 'normal' && (
<img src={item.image_url} className="rowCover" alt="" />
)}
{listingMode === 'compact' && (
<span className="counterWrapper">
<VscTriangleUp />
<span className="value">{item.reactions}</span>
</span>
)}

<span className="subTitle">{item.title}</span>
</CardLink>
</p>
Expand Down

0 comments on commit e71c580

Please sign in to comment.