Skip to content

Commit

Permalink
chore: add more examples in demo
Browse files Browse the repository at this point in the history
  • Loading branch information
David Luna authored and David Luna committed Aug 13, 2024
1 parent 2c3a384 commit c1e4ab3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions demo/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
.container {
text-align: center;
}
#code {
text-align: initial;
}
</style>
<link rel="stylesheet" href="./highlight/styles/github.css">
<script src="./highlight/highlight.pack.js"></script>
Expand Down
27 changes: 27 additions & 0 deletions demo/steps/steps-intersection.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,31 @@ export const STEPS_INTERSECTION = [
return quadrantOne.intersection(diamond);
},
},
{
comment: 'Like unions you can calculate intersection for more than two sets',
code: () => {
const quadrantOne = new Csset('.quadrant-one');
const even = new Csset('[d-even=true]');
const diamond = new Csset('.diamond');

return quadrantOne.intersection(even).intersection(diamond);
},
},
{
comment: 'A bigger intersection',
code: () => {
const quadrantFour = new Csset('.quadrant-four');
const diamond = new Csset('.diamond');
let result = quadrantFour;

for (let i = 0; i < 50; i++) {
if (i % 2 === 0) {
const s = new Csset(`[d-col=${i}]`);
result = result.intersection(s);
}
}

return result.intersection(diamond);
},
},
];

0 comments on commit c1e4ab3

Please sign in to comment.