Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Style links globally #727

Merged
merged 2 commits into from
Jan 27, 2022
Merged

Style links globally #727

merged 2 commits into from
Jan 27, 2022

Conversation

krysal
Copy link
Member

@krysal krysal commented Jan 26, 2022

Description

This small change will save us from copying the styles for links several times in every place where one appears (I was doing this in the single result page for images). The default color is pink and they should have an underline on hover state.

Testing Instructions

Run the project, everything should look the same. Writing a new link should have the default styles without requiring to do anything else.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@krysal krysal requested a review from a team as a code owner January 26, 2022 20:45
@krysal krysal requested review from obulat and dhruvkb January 26, 2022 20:45
@krysal krysal self-assigned this Jan 26, 2022
@krysal krysal added ✨ goal: improvement Improvement to an existing user-facing feature 💻 aspect: code Concerns the software code in the repository 🟨 priority: medium Not blocking but should be addressed soon labels Jan 26, 2022
Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

I love this idea! I'm wondering if there's a 'safer' way to implement it. For example, one idea would be a <TextLink> component that wraps a <NuxtLink> and applies the default text link styles.

Despite that, I think your approach works well because it ensures plain links are accessible against our standard text color by default 👍

Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

I like how much cleaner the class lists look now!
This approach might be a good way to get rid of the scss styles in the future, too.

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

Instead of styling a directly on the base, could we create a new Tailwind component like so

@layer components {
  .text-link {
    @apply text-pink hover:underline;
  }
}

so that it only applies when we explicitly call for it to be applied?

In my experience, it's easier to apply classes when needed rather than unapply them when they're applied by default.

But yeah, I do appreciate that links are no-longer colored the same as regular text.

@krysal
Copy link
Member Author

krysal commented Jan 27, 2022

I precisely wanted to forget about repeating classes for normal links 😆 I pondered whether to create a new component or not but seemed not worth it for me. This is just a change in styles that certainly should be global. One can forget to use the customized link component, go directly with an a element and forgot to apply the styles.

Although it can be a good idea if we add the function to vary between an internal and external link if Openverse continues to exist in an iframe. If this change turns out to be more problematic in the future I'll happily create the component.

@krysal krysal merged commit 3aaf038 into main Jan 27, 2022
@krysal krysal deleted the links_pink branch January 27, 2022 13:59
@krysal krysal mentioned this pull request Jan 28, 2022
1 task
rbadillap added a commit that referenced this pull request Feb 2, 2022
* main: (73 commits)
  Make audio/image pages without ids show a 404 (#768)
  Fix logo button paddings and simplify implementation (#767)
  Fix global audio rtl close placement (#780)
  Check for `null` localStorage explicitly (#763)
  Truncate global audio text to two lines (#773)
  New image details page (#682)
  Switch to path-based i18n routing (#701)
  Enable source maps in production (#755)
  Remove Jamendo and Wikimedia Commons from audio meta sources (#747)
  Use jed1x json format to correctly handle pluralization (#753)
  Fix logo color on error page layout (#752)
  Add homepage content switcher for mobile screens (#716)
  Add inline-start border to filters on desktop (#748)
  Fix header items not fitting in (#718)
  Expose `close` to popover content via slot props (#736)
  Truncate row layout audio titles (#735)
  Stop blocking on analytics requests (#715)
  Style links globally (#727)
  Refactor the usage of i18n result count computation (#707)
  Use `VPopover` for the content report form (#719)
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟨 priority: medium Not blocking but should be addressed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants