Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AspectRatio V11 Styles #1948

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 3 additions & 14 deletions src/AspectRatio/AspectRatio.svelte
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<script>
/**
* Specify the aspect ratio
* Specify the ratio to be used by the aspect ratio container.
* This will determine what aspect ratio your content will be displayed in.
* @type {"2x1" | "2x3" | "16x9" | "4x3" | "1x1" | "3x4" | "3x2" | "9x16" | "1x2"}
*/
export let ratio = "2x1";
</script>

<div
class:bx--aspect-ratio="{true}"
class:bx--aspect-ratio--2x1="{ratio === '2x1'}"
class:bx--aspect-ratio--2x3="{ratio === '2x3'}"
class:bx--aspect-ratio--16x9="{ratio === '16x9'}"
class:bx--aspect-ratio--4x3="{ratio === '4x3'}"
class:bx--aspect-ratio--1x1="{ratio === '1x1'}"
class:bx--aspect-ratio--3x4="{ratio === '3x4'}"
class:bx--aspect-ratio--3x2="{ratio === '3x2'}"
class:bx--aspect-ratio--9x16="{ratio === '9x16'}"
class:bx--aspect-ratio--1x2="{ratio === '1x2'}"
{...$$restProps}
>
<div class="{`bx--aspect-ratio bx--aspect-ratio--${ratio}`}" {...$$restProps}>
<slot />
</div>
11 changes: 5 additions & 6 deletions types/AspectRatio/AspectRatio.svelte.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import type { SvelteComponentTyped } from "svelte";
import type { SvelteHTMLElements } from "svelte/elements";

type RestProps = SvelteHTMLElements["div"];

export interface AspectRatioProps extends RestProps {
export interface AspectRatioProps {
/**
* Specify the aspect ratio
* Specify the ratio to be used by the aspect ratio container.
* This will determine what aspect ratio your content will be displayed in.
* @default "2x1"
*/
ratio?:
Expand All @@ -26,4 +24,5 @@ export default class AspectRatio extends SvelteComponentTyped<
AspectRatioProps,
Record<string, any>,
{ default: {} }
> {}
> {
}
Loading