Skip to content

Commit 3e2fba9

Browse files
committed
fix: fixes in storycard primitive
1 parent a3c8076 commit 3e2fba9

File tree

8 files changed

+27
-35
lines changed

8 files changed

+27
-35
lines changed

.changeset/curvy-gifts-shout.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@newsable/react": patch
3+
---
4+
5+
fixes in storycard primitive and tsup config

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dist
22
node_modules
33
build
4-
.env
4+
.env
5+
pnpm-lock.yaml

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dist
22
node_modules
33
build
4-
.env
4+
.env
5+
pnpm-lock.yaml

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"@radix-ui/react-toggle": "^1.0.3",
7474
"@radix-ui/react-toggle-group": "^1.0.4",
7575
"@radix-ui/react-visually-hidden": "^1.0.3",
76+
"class-variance-authority": "^0.7.0",
7677
"lucide-react": "^0.292.0"
7778
},
7879
"devDependencies": {
@@ -103,7 +104,6 @@
103104
"@typescript-eslint/parser": "^6.9.1",
104105
"@vitejs/plugin-react": "^4.1.1",
105106
"autoprefixer": "^10.4.16",
106-
"class-variance-authority": "^0.7.0",
107107
"clsx": "^2.0.0",
108108
"eslint": "^8.53.0",
109109
"eslint-config-prettier": "^9.0.0",

pnpm-lock.yaml

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/button/Button.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import React from "react";
22

3+
import "@radix-ui/react-accordion";
4+
35
import { VariantProps, cva } from "class-variance-authority";
46
import { Loader2 as Spinner } from "lucide-react";
57

68
import { cn } from "@/lib/utils";
79

10+
// ! TO FIX - variants are not getting exported
811
export const buttonVariants = cva(
912
"pointer-events-auto flex cursor-pointer items-center justify-center gap-2 rounded outline-none transition-all disabled:cursor-not-allowed disabled:opacity-75",
1013
{

src/components/story-card/StoryCard.tsx

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const StoryCardImage = React.forwardRef<HTMLImageElement, StoryCardImageProps>(
4444
const storyData = useStoryCardContext();
4545

4646
return (
47-
<Link href={storyData.slug} className="mb-2 w-full">
47+
<Link href={`/story/${storyData.id}`} className="mb-2 w-full">
4848
<AspectRatio ratio={16 / 9}>
4949
<img
5050
ref={forwardedRef}
@@ -76,10 +76,10 @@ StoryCardSection.displayName = "StoryCardSection";
7676

7777
const StoryCardTitle = React.forwardRef<React.ElementRef<typeof Heading>, HeadingBaseProps>(
7878
({ className, weight = "h3", ...props }, forwardedRef) => {
79-
const { headline, slug } = useStoryCardContext();
79+
const { headline, id } = useStoryCardContext();
8080

8181
return (
82-
<Link href={`https://www.newslaundry.com/${slug}`} className="line-clamp-2">
82+
<Link href={`/story/${id}`} className="line-clamp-2">
8383
<Heading
8484
ref={forwardedRef}
8585
weight={weight}
@@ -138,12 +138,7 @@ const Authors = ({ authors }: { authors: StoryCardProps["authors"] }) => {
138138
<Text className="line-clamp-1 w-full text-sm font-medium">
139139
{authors.map(author => {
140140
return (
141-
<Link
142-
key={author.id}
143-
href={`https://www.newslaundry.com/${author.slug}`}
144-
title={author.name}
145-
className="inline-block"
146-
>
141+
<Link key={author.id} href={`/author/${author.id}`} title={author.name} className="inline-block">
147142
{author.name}
148143
</Link>
149144
);
@@ -155,19 +150,11 @@ const Authors = ({ authors }: { authors: StoryCardProps["authors"] }) => {
155150
if (authors.length === 2) {
156151
return (
157152
<Text className="line-clamp-1 w-full text-sm font-medium">
158-
<Link
159-
href={`https://www.newslaundry.com/${authors[0].slug}`}
160-
title={authors[0].name}
161-
className="inline-block"
162-
>
153+
<Link href={`/author/${authors[0].id}`} title={authors[0].name} className="inline-block">
163154
{authors[0].name}
164155
</Link>
165156
<span className="mx-1">&</span>
166-
<Link
167-
href={`https://www.newslaundry.com/${authors[1].slug}`}
168-
title={authors[1].name}
169-
className="inline-block"
170-
>
157+
<Link href={`/author/${authors[1].id}`} title={authors[1].name} className="inline-block">
171158
{authors[1].name}
172159
</Link>
173160
</Text>
@@ -179,11 +166,7 @@ const Authors = ({ authors }: { authors: StoryCardProps["authors"] }) => {
179166
{authors.slice(0, authors.length - 1).map((author, i) => {
180167
return (
181168
<React.Fragment key={author.id}>
182-
<Link
183-
href={`https://www.newslaundry.com/${author.slug}`}
184-
title={author.name}
185-
className="inline-block"
186-
>
169+
<Link href={`/author/${author.id}`} title={author.name} className="inline-block">
187170
{author.name}
188171
</Link>
189172
{i !== authors.length - 2 ? <span className="mr-1">,</span> : null}
@@ -192,7 +175,7 @@ const Authors = ({ authors }: { authors: StoryCardProps["authors"] }) => {
192175
})}
193176
<span className="mx-1">&</span>
194177
<Link
195-
href={`https://www.newslaundry.com/${authors[authors.length - 1].slug}`}
178+
href={`/author/${authors[authors.length - 1].id}`}
196179
title={authors[authors.length - 1].name}
197180
className="inline-block"
198181
>

tsup.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ export default defineConfig({
88
target: "esnext",
99
external: ["react"],
1010
clean: true,
11-
splitting: true,
12-
minify: true
11+
splitting: true
12+
// minify: true
1313
});

0 commit comments

Comments
 (0)