Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove & replace .fancy-link and .fancy-link:hover classes #1170

Merged
merged 5 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/(app)/get-started/_client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const GetStarted: NextPage = () => {
</h2>
<p className="mt-2 text-center text-base text-neutral-500">
Or{" "}
<Link className="fancy-link font-medium" href="/">
<Link className="cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent font-medium hover:from-orange-300 hover:to-pink-500" href="/">
return home
</Link>
</p>
Expand Down
4 changes: 2 additions & 2 deletions app/(editor)/create/[[...paramsArr]]/_client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ const Create = ({ session }: { session: Session | null }) => {
href="https://www.markdownguide.org/"
target="_blank"
rel="noopener noreferrer"
className="fancy-link"
className="cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent hover:from-orange-300 hover:to-pink-500"
>
this
</a>{" "}
Expand All @@ -803,7 +803,7 @@ const Create = ({ session }: { session: Session | null }) => {
href="https://www.markdownguide.org/"
target="_blank"
rel="noopener noreferrer"
className="fancy-link"
className="cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent"
John-Paul-Larkin marked this conversation as resolved.
Show resolved Hide resolved
>
markdownguide
</a>
Expand Down
2 changes: 1 addition & 1 deletion components/ArticlePreview/ArticlePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const ArticlePreview: NextPage<Props> = ({
<div className="flex w-full content-center justify-between">
<div className="flex w-full items-center justify-between">
<Link
className="fancy-link semibold text-lg"
className="cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent hover:from-orange-300 hover:to-pink-500 semibold text-lg"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider extracting the gradient styles into a reusable class.

While the inline Tailwind classes work, consider extracting this commonly used gradient style into a reusable class in your Tailwind config to maintain consistency and make future updates easier.

You could add this to your tailwind.config.js:

module.exports = {
  theme: {
    extend: {
      // Add a custom class for gradient links
      textGradient: {
        'link': 'bg-gradient-to-r from-orange-400 to-pink-600 hover:from-orange-300 hover:to-pink-500',
      },
    },
  },
}

Then simplify the component usage to:

-className="cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent hover:from-orange-300 hover:to-pink-500 semibold text-lg"
+className="cursor-pointer text-gradient-link bg-clip-text tracking-wide text-transparent semibold text-lg"

href={`/articles/${slug}`}
>
Read full article
Expand Down
4 changes: 2 additions & 2 deletions components/Comments/CommentsArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,11 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
<p className="mb-2">Hey! 👋</p>
<p className="mb-2">Got something to say?</p>
<p>
<button onClick={() => signIn()} className="fancy-link">
<button onClick={() => signIn()} className="cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent hover:from-orange-300 hover:to-pink-500">
Sign in
</button>{" "}
or{" "}
<button onClick={() => signIn()} className="fancy-link">
<button onClick={() => signIn()} className="cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent hover:from-orange-300 hover:to-pink-500">
sign up
</button>{" "}
to leave a comment.
Expand Down
4 changes: 2 additions & 2 deletions components/EditorHints/EditorHints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const EditorHints = () => {
href="https://www.markdownguide.org/"
target="_blank"
rel="noopener noreferrer"
className="fancy-link"
className="cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent hover:from-orange-300 hover:to-pink-500"
>
this
</a>{" "}
Expand All @@ -38,7 +38,7 @@ const EditorHints = () => {
href="https://www.markdownguide.org/"
target="_blank"
rel="noopener noreferrer"
className="fancy-link"
className="cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent hover:from-orange-300 hover:to-pink-500"
>
markdownguide
Comment on lines +41 to 43
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider extracting duplicate styles into a reusable class.

The gradient styling is duplicated between both links. Consider using Tailwind's @apply directive or creating a common className variable to maintain consistency and reduce duplication.

Here's how you could refactor this:

const gradientLinkStyle = "cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent hover:from-orange-300 hover:to-pink-500";

// Then use it in both links:
className={gradientLinkStyle}

</a>
Expand Down
8 changes: 0 additions & 8 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ body {
@apply bg-white bg-gradient-to-r text-neutral-800 dark:bg-neutral-900 dark:text-white;
}

.fancy-link {
@apply cursor-pointer bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text tracking-wide text-transparent;
}

.fancy-link:hover {
@apply from-orange-300 to-pink-500;
}

.prose {
@apply prose-neutral dark:prose-invert lg:prose-lg;

Expand Down
Loading