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

[FIX] 🎨 Fikset typer og story for CopyToClipboard #1643

Merged
merged 2 commits into from
Sep 30, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
mergeRefs,
} from "@navikt/ds-react";

export interface CopyToClipboardProps extends Omit<ButtonProps, "children"> {
export interface CopyToClipboardProps
extends Omit<ButtonProps, "children" | "variant" | "loading"> {
/**
* Button text
*/
Expand Down Expand Up @@ -46,10 +47,10 @@ export interface CopyToClipboardProps extends Omit<ButtonProps, "children"> {
*/
title?: string;
/**
* Placement of icon
* @default "left"
* Components i tertiary by default. Will be removed in v2.0.0
* @breaking v2
*/
iconPosition?: "left" | "right";
variant?: "tertiary";
}

export const CopyToClipboard = forwardRef<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meta } from "@storybook/react";
import * as React from "react";
import { Link } from "@navikt/ds-icons";

import { CopyToClipboard } from "../index";

Expand Down Expand Up @@ -94,3 +95,22 @@ export const Small = () => (
</CopyToClipboard>
</div>
);

export const Ikon = () => (
<div className="rowgap">
<CopyToClipboard
iconPosition="right"
popoverText="Kopierte lenke"
copyText="3.14"
icon={<Link />}
/>
<CopyToClipboard
iconPosition="left"
popoverText="Kopierte lenke"
copyText="3.14"
icon={<Link />}
>
Kopier lenke
</CopyToClipboard>
</div>
);
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3001,7 +3001,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@navikt/ds-css@workspace:@navikt/core/css"
dependencies:
"@navikt/ds-tokens": ^1.3.2
"@navikt/ds-tokens": ^1.3.4
normalize.css: ^8.0.1
postcss: ^8.3.6
postcss-cli: ^8.3.1
Expand All @@ -3010,7 +3010,7 @@ __metadata:
languageName: unknown
linkType: soft

"@navikt/ds-icons@^1.0.0, @navikt/ds-icons@^1.3.2, @navikt/ds-icons@workspace:@navikt/core/icons":
"@navikt/ds-icons@^1.0.0, @navikt/ds-icons@^1.3.4, @navikt/ds-icons@workspace:@navikt/core/icons":
version: 0.0.0-use.local
resolution: "@navikt/ds-icons@workspace:@navikt/core/icons"
dependencies:
Expand Down Expand Up @@ -3041,8 +3041,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@navikt/ds-react-internal@workspace:@navikt/internal/react"
dependencies:
"@navikt/ds-icons": ^1.3.2
"@navikt/ds-react": ^1.3.2
"@navikt/ds-icons": ^1.3.4
"@navikt/ds-react": ^1.3.4
"@types/node": ^17.0.35
clsx: ^1.1.1
concurrently: 7.2.1
Expand All @@ -3059,12 +3059,12 @@ __metadata:
languageName: unknown
linkType: soft

"@navikt/ds-react@^1.0.0, @navikt/ds-react@^1.3.2, @navikt/ds-react@workspace:@navikt/core/react":
"@navikt/ds-react@^1.0.0, @navikt/ds-react@^1.3.4, @navikt/ds-react@workspace:@navikt/core/react":
version: 0.0.0-use.local
resolution: "@navikt/ds-react@workspace:@navikt/core/react"
dependencies:
"@floating-ui/react-dom-interactions": 0.9.2
"@navikt/ds-icons": ^1.3.2
"@navikt/ds-icons": ^1.3.4
"@radix-ui/react-tabs": 1.0.0
"@radix-ui/react-toggle-group": 1.0.0
"@testing-library/dom": 8.13.0
Expand Down Expand Up @@ -3103,7 +3103,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@navikt/ds-tailwind@workspace:@navikt/core/tailwind"
dependencies:
"@navikt/ds-tokens": ^1.3.2
"@navikt/ds-tokens": ^1.3.4
"@types/jest": ^27.0.1
"@types/node": ^17.0.35
jest: ^27.2.0
Expand All @@ -3114,7 +3114,7 @@ __metadata:
languageName: unknown
linkType: soft

"@navikt/ds-tokens@^1.3.2, @navikt/ds-tokens@workspace:@navikt/core/tokens":
"@navikt/ds-tokens@^1.3.4, @navikt/ds-tokens@workspace:@navikt/core/tokens":
version: 0.0.0-use.local
resolution: "@navikt/ds-tokens@workspace:@navikt/core/tokens"
dependencies:
Expand Down