Skip to content

Commit

Permalink
feat: new common element component with dynamic element support
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed Aug 20, 2022
1 parent 06abfba commit bfa69d2
Show file tree
Hide file tree
Showing 6 changed files with 912 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/button/src/Button.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<svelte:component
this={component}
{tag}
bind:this={element}
use={[
[
Expand Down Expand Up @@ -60,8 +61,8 @@
classMap,
dispatch,
} from '@smui/common/internal';
import { Element } from '@smui/common';
import Ripple from '@smui/ripple';
import { A, Button } from '@smui/common/elements';
const forwardEvents = forwardEventsBuilder(get_current_component());
Expand All @@ -84,7 +85,9 @@
let internalStyles: { [k: string]: string } = {};
let context = getContext<string | undefined>('SMUI:button:context');
export let component: typeof SvelteComponentDev = href == null ? Button : A;
export let component: typeof SvelteComponentDev = Element;
export let tag =
component === Element ? (href == null ? 'button' : 'a') : null;
$: actionProp =
context === 'dialog:action' && action != null
Expand Down
Loading

0 comments on commit bfa69d2

Please sign in to comment.