From 45e9081c4f8cb6fb50c20f43ec792a3fb56425a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20R=C3=B8stg=C3=A5rd=20Flatner?= <42931448+adrianflatner@users.noreply.github.com> Date: Thu, 5 Oct 2023 16:25:18 +0200 Subject: [PATCH] KOMP-257-aspectRatio (#473) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Legger til dokumentasjon for aspectRatio * Legger til navn til frame * Sjekker om iframes lager problemer * Fjerner iframes helt * npm install * Ci in build * Disabling a11y * Update AspectRatio.stories.tsx Fjernet mellomrom fra title i story. * Update AspectRatio.stories.tsx * Update AspectRatio.stories.tsx * Oppdaterer aspectRatio * upps * Create ApectRatio.mdx * Delete apps/storybook/stories/components/layout/AspectRatio/AspectRatio.mdx * Legger til gitconfig for å løse casingproblemer --------- Co-authored-by: Bente Lien Nilsen --- .../Layout/AspectRatio/ApectRatio.mdx | 27 ++++++++ .../AspectRatio/AspectRatio.stories.tsx | 65 +++++++++++++++++++ .../layout/AspectRatio/AspectRatio.mdx | 13 ---- config | 1 + package-lock.json | 1 + 5 files changed, 94 insertions(+), 13 deletions(-) create mode 100644 apps/storybook/stories/components/Layout/AspectRatio/ApectRatio.mdx create mode 100644 apps/storybook/stories/components/Layout/AspectRatio/AspectRatio.stories.tsx delete mode 100644 apps/storybook/stories/components/layout/AspectRatio/AspectRatio.mdx create mode 100644 config diff --git a/apps/storybook/stories/components/Layout/AspectRatio/ApectRatio.mdx b/apps/storybook/stories/components/Layout/AspectRatio/ApectRatio.mdx new file mode 100644 index 0000000000..b9a99275e1 --- /dev/null +++ b/apps/storybook/stories/components/Layout/AspectRatio/ApectRatio.mdx @@ -0,0 +1,27 @@ +import { Meta, Canvas, Story, Controls } from "@storybook/blocks"; +import * as AspectRatioStories from "./AspectRatio.stories"; + + + +# Aspect Ratio + +AspectRatio brukes to å legge inn responsive bilder, videoer, kart, osv. + +## Ta i bruk + +```jsx +import { AspectRatio } from "@kvib/react"; +``` + +## Props + + + + +## Kart 16 / 9 ratio + + + +## Video med maxWidth + + diff --git a/apps/storybook/stories/components/Layout/AspectRatio/AspectRatio.stories.tsx b/apps/storybook/stories/components/Layout/AspectRatio/AspectRatio.stories.tsx new file mode 100644 index 0000000000..61f491a72c --- /dev/null +++ b/apps/storybook/stories/components/Layout/AspectRatio/AspectRatio.stories.tsx @@ -0,0 +1,65 @@ +import { AspectRatio as KvibAspectRatio } from "@kvib/react/src/layout"; +import { Image } from "@kvib/react/src/"; + +import { Meta, StoryObj } from "@storybook/react"; + +const meta: Meta = { + title: "Komponenter/Layout/Aspect Ratio", + component: KvibAspectRatio, + parameters: { + docs: { + story: { inline: true }, + canvas: { sourceState: "shown" }, + }, + a11y: { + disable: true, + }, + }, + argTypes: { + ratio: { + description: "The aspect ratio of the Box. Common values are: `21/9`, `16/9`, `9/16`, `4/3`, `1.85/1`", + table: { type: { summary: "ResponsiveValue" } }, + control: "number", + }, + }, +}; + +export default meta; +type Story = StoryObj; + +export const AspectRatio: Story = { + args: { ratio: 4 / 3 }, + render: (args) => ( + + trees + + ), +}; + +export const AspectRatioMap: Story = { + args: { ratio: 16 / 9 }, + render: (args) => ( + + + + ), +}; + +export const AspectRatioVideo: Story = { + args: { maxW: "560px", ratio: 1 }, + render: (args) => ( + +