Skip to content

Commit 2b1ddce

Browse files
committed
Merge branch 'catchspider2002-button-changes'
2 parents 574ea92 + f600717 commit 2b1ddce

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,28 @@
106106
</Group>
107107
</div>
108108

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+
109126
<pre class="status">Clicked: {clicked}</pre>
110127
</section>
111128

112129
<script>
130+
import './button.scss';
113131
import Button, {Group, GroupItem, Label, Icon} from '@smui/button';
114132
import Menu from '@smui/menu';
115133
import List, {Item, Separator, Text} from '@smui/list';

0 commit comments

Comments
 (0)