Skip to content

Commit

Permalink
remove card and add class props
Browse files Browse the repository at this point in the history
  • Loading branch information
hughess committed Dec 31, 2024
1 parent 356d130 commit a643f75
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 75 deletions.

This file was deleted.

14 changes: 0 additions & 14 deletions packages/ui/core-components/src/lib/unsorted/ui/Card.svelte

This file was deleted.

14 changes: 11 additions & 3 deletions packages/ui/core-components/src/lib/unsorted/ui/Embed.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
</script>

<script>
import { cn } from '$lib/utils.js';
let className = undefined;
export { className as class };
export let url = ''; // The URL to embed
export let title = ''; // A description or title for the embed
export let width = '100%'; // Width of the embed, defaults to full width
Expand All @@ -19,9 +24,12 @@
</script>

<div
class={`embed-wrapper relative overflow-hidden ${
border ? 'border border-gray-300 rounded-md shadow-sm' : ''
}`}
class={cn(
`embed-wrapper relative overflow-hidden ${
border ? 'border border-gray-300 rounded-md shadow-sm' : ''
}`,
className
)}
style={`width: ${tailwindWidth}; height: ${tailwindHeight};`}
>
<iframe
Expand Down
18 changes: 0 additions & 18 deletions packages/ui/core-components/src/lib/unsorted/ui/Footnote.svelte

This file was deleted.

15 changes: 13 additions & 2 deletions packages/ui/core-components/src/lib/unsorted/ui/Image.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,34 @@

<script>
import { processDimension } from '../../utils.js';
import { cn } from '$lib/utils.js';
let className = undefined;
export { className as class };
export let url = ''; // URL of the image
export let description = ''; // Description for accessibility
export let width = ''; // Width of the image
export let height = ''; // Height of the image
export let align = 'center'; // center, left, right
const alignMap = {
center: 'center',
left: 'start',
right: 'end'
};
$: align = alignMap[align] || alignMap['center'];
// Processed dimensions
$: processedWidth = processDimension(width);
$: processedHeight = processDimension(height);
</script>

<div class="flex flex-col items-center text-center">
<div class="flex flex-col items-{align} text-center">
<img
src={url}
alt={description}
style={`width: ${processedWidth}; height: ${processedHeight};`}
class="max-w-full h-auto rounded"
class={cn('max-w-full h-auto rounded', className)}
loading="lazy"
/>
</div>
4 changes: 3 additions & 1 deletion packages/ui/core-components/src/lib/unsorted/ui/Link.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
<script>
import { toBoolean } from '../../utils.js';
let className = undefined;
export { className as class };
export let url = '#'; // Destination URL
export let label = 'Click here'; // Link text
export let newTab = false; // Open in a new tab
newTab = toBoolean(newTab);
export let className = ''; // Additional classes
</script>

<a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script context="module">
import Footnote from './Footnote.svelte';
import Note from './Note.svelte';
/** @type {import("@storybook/svelte").Meta}*/
export const meta = {
title: 'UI/Footnote',
component: Footnote
title: 'UI/Note',
component: Note
};
</script>

Expand All @@ -18,18 +18,18 @@

<Story name="All" args={{ x: 'x', y: 'y', series: 'series' }} let:args>
{@const data = Query.create(`select * from numeric_series`, query)}
<Footnote id="1">
<Note>
The data for this report was sourced from the World Bank World Development Indicators dataset.
</Footnote>
<Footnote id="2">
</Note>
<Note>
The data for this report was sourced from the World Bank World Development Indicators dataset.
</Footnote>
<Footnote id="3">
</Note>
<Note>
The data for this report was sourced from the World Bank World Development Indicators dataset.
</Footnote>
</Note>
<BarChart {data} {...args} />
<Footnote id="1">
<Note>
The data for this report was sourced from the World Bank World Development Indicators dataset.
</Footnote>
</Note>
<BarChart {data} {...args} />
</Story>
14 changes: 14 additions & 0 deletions packages/ui/core-components/src/lib/unsorted/ui/Note.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script context="module">
export const evidenceInclude = true;
</script>

<script>
import { cn } from '$lib/utils.js';
let className = undefined;
export { className as class };
</script>

<div class={cn('block text-xs text-gray-500 leading-none mt-0 pb-3', className)}>
<slot />
</div>
3 changes: 1 addition & 2 deletions packages/ui/core-components/src/lib/unsorted/ui/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
export { default as LinkButton } from './LinkButton.svelte';
export { default as BigLink } from './BigLink.svelte';
export { default as Card } from './Card.svelte';
export { default as ChevronToggle } from './ChevronToggle.svelte';
export { default as CodeBlock } from './CodeBlock.svelte';
export { default as Details } from './Details.svelte';
export { default as DownloadData } from './DownloadData.svelte';
export { default as EmailSignup } from './EmailSignup.svelte';
export { default as Embed } from './Embed.svelte';
export { default as Footnote } from './Footnote.svelte';
export { default as Note } from './Note.svelte';
export { default as Group } from './Group.svelte';
export { default as Image } from './Image.svelte';
export { default as LastRefreshed } from './LastRefreshed.svelte';
Expand Down

0 comments on commit a643f75

Please sign in to comment.