Skip to content

Commit

Permalink
feat(css): Allow .no-underline to overwrite text-decoration
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelastic committed Dec 3, 2020
1 parent f78117f commit 437974b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
35 changes: 35 additions & 0 deletions modules/css/lib/tailwind/plugins/textDecoration/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
describe('negativeDimensions', () => {
describe('should contain', () => {
const actual = tailwindPluginClasses('../index.js');
it.each([
[
'.underline',
{
'--text-decoration-color': 'currentColor',
textDecoration: 'underline var(--text-decoration-color)',
},
],
[
'.strike',
{
'--text-decoration-color': 'currentColor',
textDecoration: 'line-through var(--text-decoration-color)',
},
],
[
'.no-underline',
{
textDecoration: 'none',
},
],
[
'.underline-red',
{
'--text-decoration-color': '#e53e3e',
},
],
])('%s', async (key, value) => {
expect(actual[key]).toEqual(value);
});
});
});
5 changes: 5 additions & 0 deletions modules/css/lib/tailwind/plugins/textDecoration/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ module.exports = function (variants) {
};
});

// Allow .no-underline to remove all styling
baseClasses['.no-underline'] = {
textDecoration: 'none',
};

const colorClasses = generateClasses(
textDecorationColor,
'.underline-',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
none: 'none',
strike: 'line-through',
underline: 'underline',
};
4 changes: 4 additions & 0 deletions modules/docs/src/percy/text-decoration.pug
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ block content
+tailwind_table_line(`underline.${className}`)
.w-100p.h-100p.flex.flex-col.justify-center
span.underline(class=className) Hello World

+tailwind_table_line(`underline.hover_no-underline`)
.w-100p.h-100p.flex.flex-col.justify-center
a.underline.hover_no-underline(href="#") Hello World

0 comments on commit 437974b

Please sign in to comment.