Skip to content

Instantly share code, notes, and snippets.

@Wolfr
Last active January 17, 2021 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wolfr/a7fc62ed0ba8e4047af54175641525f7 to your computer and use it in GitHub Desktop.
Save Wolfr/a7fc62ed0ba8e4047af54175641525f7 to your computer and use it in GitHub Desktop.
Toolbar
body {
background: red;
}
.st-toolbar {
display: flex;
width: 100%;
justify-content: space-between;
}
.st-toolbar-group {
display: flex;
}
.st-toolbar-group--left .st-toolbar-item {
margin-right: 20px;
}
.st-toolbar-group--right .st-toolbar-item {
margin-left: 20px;
}
.st-button-group {
display: flex;
}
.st-button-group button {
margin-right: 8px;
}
button {
background: red;
}
<st-toolbar>
<st-toolbar-group side="left">
<st-toolbar-item>
<st-button-group>
<st-button label="Max" />
</st-button-group>
</st-toolbar-item>
</st-toolbar-group>
<st-toolbar-group side="right">
<st-toolbar-item>
<st-button-group>
<st-button label="Max" />
</st-button-group>
</st-toolbar-item>
</st-toolbar-group>
</st-toolbar>
import { Component, h } from '@stencil/core';
@Component({
tag: 'st-button-toolbar',
shadow: true,
})
export class StButton {
render() {
return <div class="st-toolbar-item"><slot /></div>;
}
}
import { Component, Prop, h } from '@stencil/core';
@Component({
tag: 'st-button',
shadow: true,
})
export class StButton {
@Prop() label: string;
render() {
return <button>{this.label}</button>;
}
}
import { Component, Prop, h } from '@stencil/core';
@Component({
tag: 'st-toolbar-group',
shadow: true,
})
export class StButton {
@Prop() side: string;
render() {
return <div
class={{
'st-toolbar-group': true,
'st-toolbar-group--left': this.side === 'left',
'st-toolbar-group--right': this.side === 'right'
}}
>
<slot />
</div>;
}
}
import { Component, Prop, h } from '@stencil/core';
@Component({
tag: 'st-toolbar-item',
shadow: true,
})
export class StButton {
@Prop() label: string;
render() {
return <div class="st-toolbar-item"><slot /></div>;
}
}
import { Component, h } from '@stencil/core';
@Component({
tag: 'st-toolbar',
shadow: true,
})
export class StButton {
render() {
return <div class="st-toolbar"><slot /></div>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment