// Sass (Vanilla)
.myElement {
color: blue;
display: none;
.someParent.active & {
display: block;
}
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @use "sass:list"; | |
| @use "sass:map"; | |
| $types: (( | |
| "box": ("padding", "margin-left"), | |
| "typography": ("font-size", "color"), | |
| )); | |
| @mixin component($name, $type, $styles, $scope: "myScope_") { | |
| .#{$scope + $name} { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "accordion", | |
| "title": { | |
| "background": "red", | |
| "panel-is-open": { | |
| "background": "green" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| ".accordion": { | |
| ".title": { | |
| "background": "red", | |
| ".panel.open > &": { | |
| "background": "green" | |
| }, | |
| "&:hover": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import config from './assets/config'; | |
| import styles from './assets/styles'; | |
| const Accordion = ({ panels, ...props }) => { | |
| const { name, persist } = useConfig(props); | |
| const [live, setLive] = useState( | |
| panels.reduce(($, { active, id }, i) => active ? $.concat(id || i) : $, []) | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import styles from '../'; | |
| import config from '../'; | |
| const MyModule = ({ title, ...props }) => { | |
| ... | |
| } | |
| MyModule.defaultProps = { styles, config } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import styles from '../'; | |
| import config from '../'; | |
| const MyModule = ({ styles = styles, config = config, title, ...props }) => { | |
| ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('@babel/register')(); | |
| require('jsdom-global')(); | |
| const Sass = require('node-sass'); | |
| const fs = require('fs'); | |
| const mkdirp = require('mkdirp'); | |
| const getDirName = require('path').dirname; | |
| window.matchMedia = window.matchMedia || function() { | |
| return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "Accordion", | |
| "modifiers": ["keep-open"], | |
| "components": [ | |
| { | |
| "name": "panel", | |
| "modifiers": ["active"] | |
| }, | |
| { | |
| "name": "heading", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @include module('myElement') { | |
| color: blue; | |
| display: none; | |
| @include context('someParent', 'active') { | |
| display: block; | |
| } | |
| } |
NewerOlder