Skip to content

feat(tailwind): add transparent to supported colors

Paul Gascou-Vaillancourt requested to merge tailwind-preset-color-transparent into main

What does this MR do?

transparent must be explicitly defined as a supported color in Tailwind's config to enable utils such as .gl-bg-transparent and the likes.

How to test this

  1. You can run the Tailwind Config Viewer right here: yarn tailwind-config-viewer.
  2. To see how this affects the CSS in Js in GitLab:
    1. Checkout the master branch and ensure everything is up-to-date: yarn && rm config/helpers/tailwind/css_in_js.js && yarn tailwindcss:build.
    2. Stage the CSS in Js config: git add --force config/helpers/tailwind/css_in_js.js.
    3. Install this MR's build: yarn add @gitlab/ui@https://gitlab.com/gitlab-org/gitlab-ui/-/jobs/6611874550/artifacts/raw/gitlab-ui.tailwind-preset-color-transparent.tgz
    4. Rebuild the CSS in Js: rm config/helpers/tailwind/css_in_js.js && yarn tailwindcss:build.
    5. You should see the following diff:
    diff --git a/config/helpers/tailwind/css_in_js.js b/config/helpers/tailwind/css_in_js.js
    index 17e96fd3f118..07bddf8ce936 100644
    --- a/config/helpers/tailwind/css_in_js.js
    +++ b/config/helpers/tailwind/css_in_js.js
    @@ -1,5 +1,5 @@
    /**
    - * The following 675 definitions need to be migrated to Tailwind.
    + * The following 670 definitions need to be migrated to Tailwind.
    * Let's do this! 🚀
    */
    module.exports = {
    @@ -32,7 +32,6 @@ module.exports = {
          'animation-iteration-count': '3',
       },
       },
    -  '.bg-transparent': { 'background-color': 'transparent' },
       '.hover-bg-transparent': { '&:hover': { 'background-color': 'transparent' } },
       '.bg-transparent\\!': { 'background-color': 'transparent !important' },
       '.hover-bg-transparent\\!': { '&:hover': { 'background-color': 'transparent !important' } },
    @@ -105,8 +104,6 @@ module.exports = {
       '.border-b-solid\\!': { 'border-bottom-style': 'solid !important' },
       '.border-b-initial': { 'border-bottom-style': 'initial' },
       '.border-l-solid': { 'border-left-style': 'solid' },
    -  '.border-transparent': { 'border-color': 'transparent' },
    -  '.border-t-transparent': { 'border-top-color': 'transparent' },
       '.border-t-transparent\\!': { 'border-top-color': 'transparent !important' },
       '.hover-border-gray-100': { '&:hover': { 'border-color': 'var(--gray-100, #dcdcde)' } },
       '.border-gray-100\\!': { 'border-color': 'var(--gray-100, #dcdcde) !important' },
    @@ -215,7 +212,6 @@ module.exports = {
       },
       '.reset-color': { color: 'inherit' },
       '.reset-color\\!': { color: 'inherit !important' },
    -  '.text-transparent': { color: 'transparent' },
       '.text-white\\!': { color: 'var(--white, #fff) !important' },
       '.text-body': { color: 'var(--gl-text-primary, #333238)' },
       '.text-body\\!': { color: 'var(--gl-text-primary, #333238) !important' },
    @@ -678,7 +674,6 @@ module.exports = {
       '.lg-pt-3': { '@media (min-width: 992px)': { 'padding-top': '0.5rem' } },
       '.lg-pr-5': { '@media (min-width: 992px)': { 'padding-right': '1rem' } },
       '.fill-current-color': { fill: 'currentColor' },
    -  '.fill-transparent': { fill: 'transparent' },
       '.text-left\\!': { 'text-align': 'left !important' },
       '.text-center\\!': { 'text-align': 'center !important' },
       '.reset-text-align': { 'text-align': 'inherit' },

Screenshots or screen recordings

Screenshot_2024-04-12_at_7.35.02_AM

Integration merge requests

Does this MR meet the acceptance criteria?

This checklist encourages the authors, reviewers, and maintainers of merge requests (MRs) to confirm changes were analyzed for conformity with the project's guidelines, security and accessibility.

Toggle the acceptance checklist

Conformity

  • Code review guidelines.
  • GitLab UI's contributing guidelines.
  • If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer.
  • If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer.
  • If the MR changes a component's API, integration MR(s) have been opened (see integration merge requests above).
  • Added the ~"component:*" label(s) if applicable.

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • Security reports checked/validated by a reviewer from the AppSec team

Accessibility

If this MR adds or modifies a component, take a few moments to review the following:

  • All actions and functionality can be done with a keyboard.
  • Links, buttons, and controls have a visible focus state.
  • All content is presented in text or with a text equivalent. For example, alt text for SVG, or aria-label for icons that have meaning or perform actions.
  • Changes in a component’s state are announced by a screen reader. For example, changing aria-expanded="false" to aria-expanded="true" when an accordion is expanded.
  • Color combinations have sufficient contrast.
Edited by Paul Gascou-Vaillancourt

Merge request reports