Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions example/src/app.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

import Header from "./components/Header/Header";
import Card from "./components/Card/Card";
import Card, { SpecialCard } from "./components/Card/Card";
import Gallery from "./components/Gallery/Gallery";

import appStyles from "./app.component.scss";
Expand Down Expand Up @@ -59,10 +59,11 @@ const App = () => {
dolor sit amet consectetur adipisicing elit. Illo commodi, deleniti temporibus explicabo facilis
laborum praesentium eos, a pariatur fugiat quo impedit quod ipsam animi.
</Card>
<Card header="Lorem ipsum">
dolor sit amet consectetur adipisicing elit. Illo commodi, deleniti temporibus explicabo facilis
laborum praesentium eos, a pariatur fugiat quo impedit quod ipsam animi.
</Card>
<SpecialCard header="Special card">
This card has an extra element that wraps the original card component. In order to use the same
stylesheet for both cards, the <i>data-style</i> attribute is also applied to the wrapper
element.
</SpecialCard>
</div>
</section>
<section>
Expand Down
5 changes: 5 additions & 0 deletions example/src/components/Card/Card.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@
background-color: #fff;
}
}

.special-card {
--size: 5px;
mask: radial-gradient(var(--size) at 50% 0%, #0000 99%, red 101%) 50% var(--size) / calc(4 * var(--size)) 100% repeat-x;
}
9 changes: 9 additions & 0 deletions example/src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ function Card({ header, children }) {
);
}

function SpecialCard({ header, children }) {
return (
<div className="special-card" data-style={styles}>
<Card header={header}>{children}</Card>
</div>
);
}

export default Card;
export { SpecialCard };
9 changes: 8 additions & 1 deletion src/cssScopeLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,14 @@ module.exports = function (source) {
{
type: "Selector",
loc: null,
children: [attributeValueSelector, childCombinator, attributeSelector, childCombinator, typeSelector]
children: [
attributeValueSelector,
childCombinator,
attributeSelector,
not([attributeValueSelector]),
childCombinator,
typeSelector
]
}
])
);
Expand Down