Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add tailwindcss-rtl plugin and test it in DownloadButton (#336)
sarayourfrienda6373f63dd08
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 3609596bd..a3cd6b789 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -48,6 +48,14 @@ We use JSDoc to document type definitions for functions throughout the code baseTypeScript support in Vue 2 (which we're currently locked into due to Nuxt's current limitations), is an afterthought. Therefore, types are primarily focused on the Vuex store and API service/utility functions. However, it is possible to add type annotations to some parts of Vue components, like the return value of the `data` function. Whenever possible, contributors should add or correct types to functions they are adding or modifying.+### Styles/CSS++We use TailwindCSS for writing styles. There are some legacy components that have been written in "hand-written" CSS. Our aim is to eventually re-write these using Tailwind classes.++Our Tailwind configuration lives at [`./tailwind.config.js`](./tailwind.config.js) and is a useful reference for Openverse specific spacing and color classes. Please refer to the official [TailwindCSS documentation](https://tailwindcss.com/docs) for a detailed and searchable list of the available classes. At times you'll need to cross reference this documentation with our specific configuration in the `tailwind.config.js` file.++We also use the [TailwindCSS RTL](https://github.com/20lives/tailwindcss-rtl) plugin to make writing RTL styles seamless. Most use cases of the right/left based classes should use the start/end variants introduced by the plugin instead.+## Questions or Thoughts?Feel free to [join us on Slack](https://make.wordpress.org/chat/) and discuss the project with the engineers and community members on #openverse.diff --git a/package-lock.json b/package-lock.jsonindex 930b46a0d..35820f821 100644--- a/package-lock.json+++ b/package-lock.json@@ -74,6 +74,7 @@"postcss": "^8.3.6","prettier": "^2.2.1","tailwindcss": "^2.2.7",+ "tailwindcss-rtl": "^0.7.3","vue-i18n-extract": "^2.0.0","vue-jest": "^3.0.7"},@@ -36226,6 +36227,12 @@"postcss": "^8.0.9"}},+ "node_modules/tailwindcss-rtl": {+ "version": "0.7.3",+ "resolved": "https://registry.npmjs.org/tailwindcss-rtl/-/tailwindcss-rtl-0.7.3.tgz",+ "integrity": "sha512-4lOuA5HJj/a9qBmnPmzdxJybqmQUKhA4/iDBiGs7YZqJ7eqSziKR035er3ZhGOl08s3FaKwlgNPlgQ13vMs/Tw==",+ "dev": true+ },"node_modules/tailwindcss/node_modules/arg": {"version": "5.0.0","integrity": "sha512-4P8Zm2H+BRS+c/xX1LrHw0qKpEhdlZjLCgWy+d78T9vqa2Z2SiD2wMrYuWIAFy5IZUD7nnNXroRttz+0RzlrzQ==",@@ -67476,6 +67483,12 @@}}},+ "tailwindcss-rtl": {+ "version": "0.7.3",+ "resolved": "https://registry.npmjs.org/tailwindcss-rtl/-/tailwindcss-rtl-0.7.3.tgz",+ "integrity": "sha512-4lOuA5HJj/a9qBmnPmzdxJybqmQUKhA4/iDBiGs7YZqJ7eqSziKR035er3ZhGOl08s3FaKwlgNPlgQ13vMs/Tw==",+ "dev": true+ },"tapable": {"version": "1.1.3","integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA=="diff --git a/package.json b/package.jsonindex 9ef492ff3..f0005a009 100644--- a/package.json+++ b/package.json@@ -99,6 +99,7 @@"postcss": "^8.3.6","prettier": "^2.2.1","tailwindcss": "^2.2.7",+ "tailwindcss-rtl": "^0.7.3","vue-i18n-extract": "^2.0.0","vue-jest": "^3.0.7"},diff --git a/src/components/DownloadButton.vue b/src/components/DownloadButton.vueindex 68e6d213a..10826d498 100644--- a/src/components/DownloadButton.vue+++ b/src/components/DownloadButton.vue@@ -12,10 +12,10 @@download=""><span>{{ $t('download-button.download') }}</span>- <span class="ml-4 selected-format">+ <span class="ms-4 selected-format">{{ selectedFormat.extension_name }}</span>- <span class="ml-1 font-normal">{{+ <span class="ms-1 font-normal">{{getFormatSize(selectedFormat.extension_name)}}</span></a>@@ -48,7 +48,7 @@"@keydown="onItemKeydown($event)">- <span class="font-bold mr-2">{{ format.extension_name }}</span>+ <span class="font-bold me-2">{{ format.extension_name }}</span><span>{{ getFormatSize(format.extension_name) }}</span></button></li>diff --git a/src/components/DropdownButton.vue b/src/components/DropdownButton.vueindex 7581b1615..292530c63 100644--- a/src/components/DropdownButton.vue+++ b/src/components/DropdownButton.vue@@ -4,7 +4,7 @@<div class="flex"><slot:button-props="{- class: 'dropdown-button rounded-l-sm rounded-r-none',+ class: 'dropdown-button rounded-s-sm rounded-e-none',type: 'button',}"/>@@ -12,7 +12,7 @@v-if="!isSingleItem"ref="dropdownButton"type="button"- class="dropdown-button ml-1 rounded-r-sm rounded-l-none w-14"+ class="dropdown-button ms-1 rounded-e-sm rounded-s-none w-14":class="{ 'dropdown-button-active': isOpen }"aria-haspopup="menu":aria-label="safeDropdownAriaLabel"diff --git a/tailwind.config.js b/tailwind.config.jsindex 080fab5ea..87bcec5ac 100644--- a/tailwind.config.js+++ b/tailwind.config.js@@ -172,5 +172,5 @@ module.exports = {ringWidth: ['focus-visible'],},},- plugins: [],+ plugins: [require('tailwindcss-rtl')],}