Skip to content

Commit

Permalink
Merge pull request #27 from SG60/25-soundcloud-svelte-component
Browse files Browse the repository at this point in the history
  • Loading branch information
SG60 authored May 28, 2022
2 parents d90a1fe + aeb7b33 commit 05b3821
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sg60/sam-svelte-components",
"version": "0.1.0",
"version": "0.2.0",
"repository": {
"type": "git",
"url": "git://github.com/sg60/sam-svelte-components.git"
Expand All @@ -13,6 +13,7 @@
"build": "svelte-kit build",
"package": "svelte-kit package",
"preview": "svelte-kit preview",
"prepare": "svelte-kit sync",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
Expand Down
17 changes: 17 additions & 0 deletions src/lib/SoundCloud.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script type="ts">
export let url: string;
export let title = 'SoundCloud Player';
export let height: 166 | 300 | 450 | 600 = 166;
export let color = '4f6cec';
</script>

<div>
<iframe
{title}
width="100%"
{height}
scrolling="no"
frameborder="no"
src="https://w.soundcloud.com/player/?url={url}&amp;color={color}&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false"
/>
</div>
25 changes: 25 additions & 0 deletions src/stories/SoundCloud.stories.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script lang="ts">
import { Meta, Template, Story } from '@storybook/addon-svelte-csf';
import SoundCloud from '$lib/SoundCloud.svelte';
</script>

<Meta
title="SoundCloud Embed"
component={SoundCloud}
argTypes={{
// trackId: { control: 'text', defaultValue: '1202071039' },
title: { control: 'text' },
url: { control: 'text' },
height: { control: 'select', options: [166, 300, 450, 600] },
color: { control: 'text', defaultValue: '4f6cec' }
}}
/>

<Template let:args><SoundCloud {...args} /></Template>

<Story name="default" args={{ url: 'https://soundcloud.com/samgreening/frames' }} />

<Story
name="playlist"
args={{ url: 'https://soundcloud.com/samgreening/sets/edward-thomas-songs', height: 300 }}
/>

0 comments on commit 05b3821

Please sign in to comment.