Skip to content

Commit

Permalink
feat(Button): add download prop
Browse files Browse the repository at this point in the history
  • Loading branch information
DSil committed Mar 22, 2023
1 parent a1a6d64 commit a27447c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/orbit-components/src/Button/README.md
Expand Up @@ -28,6 +28,7 @@ Table below contains all types of the props available in Button component.
| dataTest | `string` | | Optional prop for testing purposes. |
| id | `string` | | Set `id` for `Button` |
| disabled | `boolean` | `false` | If `true`, the Button will be disabled. |
| download | `boolean \| string` | | Can only be used when `href` is defined. Adds the `download` attribute to the the anchor element. |
| external | `boolean` | `false` | If `true`, the Button opens link in a new tab. [See Functional specs](#functional-specs) |
| href | `string` | | The URL of the link to open when Button is clicked. [See Functional specs](#functional-specs) |
| iconLeft | `React.Node` | | The displayed icon on the left. |
Expand Down
19 changes: 7 additions & 12 deletions packages/orbit-components/src/Button/types.d.ts
@@ -1,7 +1,12 @@
// Type definitions for @kiwicom/orbit-components
// Project: http://github.com/kiwicom/orbit

import type { ButtonCommonProps, Size } from "../primitives/ButtonPrimitive/types";
import type {
ButtonCommonProps,
Size,
DownloadWithHrefConditionalProps,
FullWidthConditionalProps,
} from "../primitives/ButtonPrimitive/types";

export type Type =
| "primary"
Expand All @@ -16,19 +21,9 @@ export type Type =

export type ButtonStates = "default" | "hover" | "active" | "focus";

type FullWidthConditionalProps =
| {
readonly fullWidth: true;
readonly centered?: boolean;
}
| {
readonly fullWidth?: false;
readonly centered?: never;
};

interface ButtonProps extends ButtonCommonProps {
readonly type?: Type;
readonly size?: Size;
}

export type Props = ButtonProps & FullWidthConditionalProps;
export type Props = ButtonProps & FullWidthConditionalProps & DownloadWithHrefConditionalProps;

0 comments on commit a27447c

Please sign in to comment.