1
0
Fork 0
mirror of synced 2024-10-02 18:16:29 +13:00

WIP: Beginnings of button and ClassBuilder

This commit is contained in:
Conor Mack 2020-01-29 10:10:25 +00:00
parent 02b512ffd9
commit d5b7536578
3 changed files with 39 additions and 6 deletions

View file

@ -1,12 +1,39 @@
<script>
import "@material/button/mdc-button.scss";
export let raised = false;
import "@material/button/_mixins.scss";
let c = raised ? "mdc-button mdc-button--raised" : "mdc-button";
//TODO: How does theme color work for this?
//TODO: Add action for ripple
//TODO: Create class builder class or fn
/*
==BLOCK MODIFIERS==
raised = via variant prop
outlined = via variant prop
unelevated = via variant prop
touch = needs accessibility wrapper div
*/
export let text = "";
//Either raised,outlined or unelevated
export let variant = "raised";
export let colour = "primary";
export let disabled = false; //added directly to button element (not in class)
export let icon = "";
export let trailingIcon = false;
$: renderLeadingIcon = !!icon && !trailingIcon;
$: renderTrailingIcon = !!icon && trailingIcon;
</script>
<button class={c}>
<button class="mdc-button" {disabled}>
<div class="mdc-button__ripple" />
<span class="mdc-button__label">Button</span>
{#if renderLeadingIcon}
<i class="material-icons mdc-button__icon" aria-hidden="true">{icon}</i>
{/if}
<span class="mdc-button__label">{text}</span>
{#if renderTrailingIcon}
<i class="material-icons mdc-button__icon" aria-hidden="true">{icon}</i>
{/if}
</button>

View file

@ -0,0 +1,6 @@
export default class ClassBuilder {
block = "";
constructor(block) {
this.block = `mdc-${block}`;
}
}

View file

@ -7,6 +7,6 @@ export const props = {
button: {
_component: "@budibase/materialdesign-components/button",
_children: [],
raised: true
variant: "raised"
}
};