Skip to content

Commit bfa69d2

Browse files
committed
feat: new common element component with dynamic element support
1 parent 06abfba commit bfa69d2

File tree

6 files changed

+912
-3
lines changed

6 files changed

+912
-3
lines changed

packages/button/src/Button.svelte

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<svelte:component
22
this={component}
3+
{tag}
34
bind:this={element}
45
use={[
56
[
@@ -60,8 +61,8 @@
6061
classMap,
6162
dispatch,
6263
} from '@smui/common/internal';
64+
import { Element } from '@smui/common';
6365
import Ripple from '@smui/ripple';
64-
import { A, Button } from '@smui/common/elements';
6566
6667
const forwardEvents = forwardEventsBuilder(get_current_component());
6768
@@ -84,7 +85,9 @@
8485
let internalStyles: { [k: string]: string } = {};
8586
let context = getContext<string | undefined>('SMUI:button:context');
8687
87-
export let component: typeof SvelteComponentDev = href == null ? Button : A;
88+
export let component: typeof SvelteComponentDev = Element;
89+
export let tag =
90+
component === Element ? (href == null ? 'button' : 'a') : null;
8891
8992
$: actionProp =
9093
context === 'dialog:action' && action != null

0 commit comments

Comments
 (0)