Skip to content

Commit

Permalink
Allow lead class to override element styles (#260)
Browse files Browse the repository at this point in the history
* Allow lead to override element styles

* Update changelog
  • Loading branch information
thecrypticace committed Mar 25, 2022
1 parent 1874110 commit 83f3a83
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add styles for `tfoot` elements ([#243](https://github.com/tailwindlabs/tailwindcss-typography/pull/243))

## Fixed

- Fix prose elements `legacy` mode ([#259](https://github.com/tailwindlabs/tailwindcss-typography/pull/259))
- Allow `lead` class to override element styles ([#260](https://github.com/tailwindlabs/tailwindcss-typography/pull/260))

## [0.5.2] - 2022-02-14

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ module.exports = plugin.withOptions(

for (let [name, selector = name] of [
['headings', 'h1, h2, h3, h4, th'],
['lead', '[class~="lead"]'],
['h1'],
['h2'],
['h3'],
Expand All @@ -116,6 +115,7 @@ module.exports = plugin.withOptions(
['img'],
['video'],
['hr'],
['lead', '[class~="lead"]'],
]) {
addVariant(`${className}-${name}`, target === 'legacy' ? `& ${selector}` : `& :is(${inWhere(selector, options)})`)
}
Expand Down
12 changes: 6 additions & 6 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,6 @@ test('element variants', async () => {
:is(:where(h1, h2, h3, h4, th):not(:where([class~='not-prose'] *))) {
text-decoration-line: underline;
}
.prose-lead\:italic :is(:where([class~='lead']):not(:where([class~='not-prose'] *))) {
font-style: italic;
}
.prose-h1\:text-3xl :is(:where(h1):not(:where([class~='not-prose'] *))) {
font-size: 1.875rem;
line-height: 2.25rem;
Expand Down Expand Up @@ -694,6 +691,9 @@ test('element variants', async () => {
.prose-hr\:border-t-2 :is(:where(hr):not(:where([class~='not-prose'] *))) {
border-top-width: 2px;
}
.prose-lead\:italic :is(:where([class~="lead"]):not(:where([class~="not-prose"] *))) {
font-style: italic;
}
`
)
})
Expand Down Expand Up @@ -781,9 +781,6 @@ test('element variants with custom class name', async () => {
:is(:where(h1, h2, h3, h4, th):not(:where([class~='not-markdown'] *))) {
text-decoration-line: underline;
}
.markdown-lead\:italic :is(:where([class~='lead']):not(:where([class~='not-markdown'] *))) {
font-style: italic;
}
.markdown-h1\:text-3xl :is(:where(h1):not(:where([class~='not-markdown'] *))) {
font-size: 1.875rem;
line-height: 2.25rem;
Expand Down Expand Up @@ -868,6 +865,9 @@ test('element variants with custom class name', async () => {
.markdown-hr\:border-t-2 :is(:where(hr):not(:where([class~='not-markdown'] *))) {
border-top-width: 2px;
}
.markdown-lead\:italic :is(:where([class~="lead"]):not(:where([class~="not-markdown"] *))) {
font-style: italic;
}
`
)
})
Expand Down

1 comment on commit 83f3a83

@vercel
Copy link

@vercel vercel bot commented on 83f3a83 Mar 25, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.