Skip to content

Commit

Permalink
moving text-subtitle to a Tailwind plugin so BlockTable and @apply wi…
Browse files Browse the repository at this point in the history
…thout importing the typography CSS (#502)
  • Loading branch information
stephiescastle committed Jul 18, 2024
1 parent 59abf06 commit be8543f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
16 changes: 9 additions & 7 deletions packages/common/src/scss/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,15 @@
}
}

.text-subtitle {
@apply font-secondary uppercase text-base leading-tight tracking-wider;
}

.text-subtitle-sm {
@apply font-secondary uppercase text-sm leading-tight tracking-wider;
}
// moved to a tailwind plugin in tailwind.config.js which allows us to @apply text-subtitle
// .text-subtitle {
// @apply font-secondary uppercase text-base leading-tight tracking-wider;
// }

// moved to a tailwind plugin in tailwind.config.js which allows us to @apply text-subtitle
// .text-subtitle-sm {
// @apply font-secondary uppercase text-sm leading-tight tracking-wider;
// }

.text-body-lg {
font-size: pxToRem(18); // Based on Tailwind's text-lg
Expand Down
5 changes: 4 additions & 1 deletion packages/common/src/scss/components/_BlockTable.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// needed to @extend .BlockText
@import '@explorer-1/common/src/scss/components/BlockText';

.BlockTable {
table {
@apply border-gray-light-mid border-t border-b border-collapse w-full;
Expand All @@ -8,7 +11,7 @@
}

th {
@apply p-3 lg:p-5 border-gray-light-mid border-b text-subtitle text-white text-left font-normal;
@apply p-3 lg:p-5 border-gray-light-mid border-b font-secondary uppercase text-base leading-tight tracking-wider text-white text-left font-normal;
}

tbody {
Expand Down
7 changes: 7 additions & 0 deletions packages/common/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,13 @@ export default {
require('@tailwindcss/forms'),
plugin(({ addBase }) => {
addBase({
// reusable typography classes TODO: write a more robust way to include most typography classes
'.text-subtitle': {
'@apply font-secondary uppercase text-base leading-tight tracking-wider': {}
},
'.text-subtitle-sm': {
'@apply font-secondary uppercase text-sm leading-tight tracking-wider': {}
},
// www theme selectors
':root, .ThemeVariantLight': ThemeWww.default,
'.ThemeVariantDark': ThemeWww.dark,
Expand Down
4 changes: 0 additions & 4 deletions packages/vue/src/components/BlockTable/BlockTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,5 @@ export default defineComponent({
</script>

<style lang="scss">
@import '@explorer-1/common/src/scss/typography';
// required for @apply text-subtitle in _BlockTable.scss
@import '@explorer-1/common/src/scss/components/BlockText';
// required for @extend .BlockText in _BlockTable.scss
@import '@explorer-1/common/src/scss/components/BlockTable';
</style>

0 comments on commit be8543f

Please sign in to comment.