Skip to content

Commit f600717

Browse files
committed
chore: remove shape button option and recreate with Sass demos
1 parent 6ed64b5 commit f600717

File tree

5 files changed

+42
-20
lines changed

5 files changed

+42
-20
lines changed

packages/button/Button.svelte

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
{variant === 'raised' ? 'mdc-button--raised' : ''}
99
{variant === 'unelevated' ? 'mdc-button--unelevated' : ''}
1010
{variant === 'outlined' ? 'mdc-button--outlined' : ''}
11-
{shape === 'rounded' ? 'smui-button-rounded' : ''}
1211
{dense ? 'mdc-button--dense' : ''}
1312
{color === 'secondary' ? 'smui-button--color-secondary' : ''}
1413
{context === 'card:action' ? 'mdc-card__action' : ''}
@@ -34,7 +33,6 @@
3433
{variant === 'raised' ? 'mdc-button--raised' : ''}
3534
{variant === 'unelevated' ? 'mdc-button--unelevated' : ''}
3635
{variant === 'outlined' ? 'mdc-button--outlined' : ''}
37-
{shape === 'rounded' ? 'smui-button-rounded' : ''}
3836
{dense ? 'mdc-button--dense' : ''}
3937
{color === 'secondary' ? 'smui-button--color-secondary' : ''}
4038
{context === 'card:action' ? 'mdc-card__action' : ''}
@@ -67,7 +65,6 @@
6765
export let ripple = true;
6866
export let color = 'primary';
6967
export let variant = 'text';
70-
export let shape;
7168
export let dense = false;
7269
export let href = null;
7370
export let action = 'close';
@@ -78,7 +75,7 @@
7875
7976
$: dialogExcludes = (context === 'dialog:action') ? ['action', 'default'] : [];
8077
81-
$: props = exclude($$props, ['use', 'class', 'ripple', 'color', 'variant', 'shape', 'dense', 'href', ...dialogExcludes]);
78+
$: props = exclude($$props, ['use', 'class', 'ripple', 'color', 'variant', 'dense', 'href', ...dialogExcludes]);
8279
8380
$: actionProp = (context === 'dialog:action' && action !== null) ? {'data-mdc-dialog-action': action} : {};
8481
$: defaultProp = (context === 'dialog:action' && defaultAction) ? {'data-mdc-dialog-button-default': ''} : {};

packages/button/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ A button.
4747
* `ripple`: `true` - Whether to implement a ripple for when the component is interacted with.
4848
* `color`: `'primary'` - The button's color. ('primary' or 'secondary')
4949
* `variant`: `'text'` - The button's style variant. ('text', 'raised', 'unelevated', or 'outlined')
50-
* `shape`: `''` - The button's shape. If the shape property is set to rounded, it creates a rounded button instead of a regular button. ('rounded')
5150
* `dense`: `false` - Whether to style the button as dense.
5251
* `href`: `null` - If the `href` property is set, the button will use an anchor element, instead of a button element.
5352
* `action`: `'close'` - Used in the context of a dialog. This sets the button's action.

packages/button/_mixins.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44
@mixin smui-button-core-styles($query: mdc-feature-all()) {
55
@include smui-button-without-ripple($query);
66
@include smui-button-ripple($query);
7-
@include smui-button-rounded($query);
8-
}
9-
10-
@mixin smui-button-rounded($query: mdc-feature-all()) {
11-
.smui-button-rounded {
12-
@include mdc-button-shape-radius(999px);
13-
}
147
}
158

169
@mixin smui-button-without-ripple($query: mdc-feature-all()) {

site/src/routes/demo/button.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@import "@material/button/mixins";
2+
@import "@material/shape/variables";
3+
4+
.button-shaped-round {
5+
@include mdc-button-shape-radius(999px);
6+
}
7+
8+
.button-shaped-notch {
9+
--notchSize: #{$mdc-shape-small-component-radius * 2};
10+
11+
// source: https://css-tricks.com/notched-boxes/
12+
clip-path:
13+
polygon(
14+
0% var(--notchSize),
15+
var(--notchSize) 0%,
16+
calc(100% - var(--notchSize)) 0%,
17+
100% var(--notchSize),
18+
100% calc(100% - var(--notchSize)),
19+
calc(100% - var(--notchSize)) 100%,
20+
var(--notchSize) 100%,
21+
0% calc(100% - var(--notchSize))
22+
);
23+
}

site/src/routes/demo/button.svelte

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@
3838
<Button color="secondary" on:click={() => clicked++}><Label>Trailing Icon</Label><Icon class="material-icons">favorite</Icon></Button>
3939
</div>
4040

41-
<div>
42-
Shaped button: <br />
43-
<Button on:click={() => clicked++} variant="unelevated" shape="rounded"><Label>Unelevated</Label></Button>
44-
<Button on:click={() => clicked++} variant="outlined" shape="rounded"><Label>Outlined</Label></Button>
45-
<Button on:click={() => clicked++} variant="unelevated" shape="rounded"><Icon class="material-icons">favorite</Icon><Label>Icon</Label></Button>
46-
<Button on:click={() => clicked++} variant="unelevated" shape="rounded"><Label>Trailing Icon</Label><Icon class="material-icons">favorite</Icon></Button>
47-
</div>
48-
4941
<div>
5042
Button groups: <br />
5143
<Group>
@@ -114,10 +106,28 @@
114106
</Group>
115107
</div>
116108

109+
<div>
110+
Creating rounded buttons with Sass mixins: <br />
111+
<Button on:click={() => clicked++} variant="raised" class="button-shaped-round"><Label>Raised</Label></Button>
112+
<Button on:click={() => clicked++} variant="unelevated" class="button-shaped-round"><Label>Unelevated</Label></Button>
113+
<Button on:click={() => clicked++} variant="outlined" class="button-shaped-round"><Label>Outlined</Label></Button>
114+
<Button on:click={() => clicked++} variant="unelevated" class="button-shaped-round"><Icon class="material-icons">favorite</Icon><Label>Icon</Label></Button>
115+
<Button on:click={() => clicked++} variant="outlined" class="button-shaped-round"><Label>Trailing Icon</Label><Icon class="material-icons">favorite</Icon></Button>
116+
</div>
117+
118+
<div>
119+
Creating notched buttons with vanilla Sass: <br />
120+
<Button on:click={() => clicked++} variant="raised" class="button-shaped-notch"><Label>Raised</Label></Button>
121+
<Button on:click={() => clicked++} variant="unelevated" class="button-shaped-notch"><Label>Unelevated</Label></Button>
122+
<Button on:click={() => clicked++} variant="unelevated" class="button-shaped-notch"><Icon class="material-icons">favorite</Icon><Label>Icon</Label></Button>
123+
<Button on:click={() => clicked++} variant="unelevated" class="button-shaped-notch"><Label>Trailing Icon</Label><Icon class="material-icons">favorite</Icon></Button>
124+
</div>
125+
117126
<pre class="status">Clicked: {clicked}</pre>
118127
</section>
119128

120129
<script>
130+
import './button.scss';
121131
import Button, {Group, GroupItem, Label, Icon} from '@smui/button';
122132
import Menu from '@smui/menu';
123133
import List, {Item, Separator, Text} from '@smui/list';

0 commit comments

Comments
 (0)