mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 02:41:05 +00:00
Merge pull request #44 from metonym/skeleton
refactor(skeleton): forward events, remove exported props
This commit is contained in:
commit
bbb1a776c0
3 changed files with 15 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { withKnobs, select } from '@storybook/addon-knobs';
|
import { withKnobs, select } from '@storybook/addon-knobs';
|
||||||
import Component from './SkeletonPlaceholder.Story.svelte';
|
import Component from './SkeletonPlaceholder.Story.svelte';
|
||||||
|
|
||||||
export default { title: 'Skeleton Placeholder', decorators: [withKnobs] };
|
export default { title: 'SkeletonPlaceholder', decorators: [withKnobs] };
|
||||||
|
|
||||||
const classes = {
|
const classes = {
|
||||||
'my--skeleton__placeholder--small': 'my--skeleton__placeholder--small',
|
'my--skeleton__placeholder--small': 'my--skeleton__placeholder--small',
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<script>
|
<script>
|
||||||
let className = undefined;
|
let className = undefined;
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
const _class = cx('--skeleton__placeholder', className);
|
const _class = cx('--skeleton__placeholder', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div {...props} class={_class} />
|
<div on:click on:mouseover on:mouseenter on:mouseleave {style} class={_class} />
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
export let lineCount = 3;
|
export let lineCount = 3;
|
||||||
export let width = '100%';
|
export let width = '100%';
|
||||||
export let heading = false;
|
export let heading = false;
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
const widthNum = parseInt(width, 10);
|
const widthNum = parseInt(width, 10);
|
||||||
const widthPx = width.includes('px');
|
const widthPx = width.includes('px');
|
||||||
const widthPercent = width.includes('%');
|
const widthPercent = width.includes('%');
|
||||||
|
|
||||||
let lines = [];
|
let lines = [];
|
||||||
|
|
||||||
$: if (paragraph) {
|
$: if (paragraph) {
|
||||||
|
@ -27,11 +28,18 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if paragraph}
|
{#if paragraph}
|
||||||
<div>
|
<div on:click on:mouseover on:mouseenter on:mouseleave {style}>
|
||||||
{#each lines as { width }}
|
{#each lines as { width }}
|
||||||
<p {...props} class={_class} style={`width: ${width};`} />
|
<p class={_class} style={`width: ${width};`} />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<p {...props} class={_class} style={`width: ${width};`} />
|
<p
|
||||||
|
on:click
|
||||||
|
on:mouseover
|
||||||
|
on:mouseenter
|
||||||
|
on:mouseleave
|
||||||
|
{style}
|
||||||
|
class={_class}
|
||||||
|
style={`width: ${width};`} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue