Skip to content

Commit 6f423ba

Browse files
committed
feat(ButtonMobileStore): make alt prop required
BREAKING CHANGE: Because of accessibility, the alt prop is now required on the ButtonMobileStore component. This will be used as the alt attribute of the image. Make sure the passed value is properly translated.
1 parent 9287100 commit 6f423ba

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

packages/orbit-components/src/ButtonMobileStore/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ButtonMobileStore from "@kiwicom/orbit-components/lib/ButtonMobileStore";
99
After adding import into your project you can use it simply like:
1010

1111
```jsx
12-
<ButtonMobileStore type="appStore" />
12+
<ButtonMobileStore alt="Download on the App Store" type="appStore" />
1313
```
1414

1515
## Props
@@ -18,7 +18,7 @@ Table below contains all types of the props available in the ButtonMobileStore c
1818

1919
| Name | Type | Default | Description |
2020
| :-------------- | :------------------------- | :----------- | :---------------------------------------------------------------------------- |
21-
| alt | `string` | | Optional property for passing own `alt` attribute to the DOM image element. |
21+
| **alt** | `string` | | Required property for passing `alt` attribute to the DOM image element. |
2222
| title | `string` | | Optional property for passing own `title` attribute to the DOM image element. |
2323
| dataTest | `string` | | Optional prop for testing purposes. |
2424
| id | `string` | | Set `id` for `ButtonMobileStore`. |

packages/orbit-components/src/ButtonMobileStore/__tests__/index.test.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ describe("ButtonMobileStore", () => {
1111
it("default", async () => {
1212
const onClick = jest.fn();
1313
render(
14-
<ButtonMobileStore onClick={onClick} dataTest="test" type={TYPE_OPTIONS.APPSTORE} href="#" />,
14+
<ButtonMobileStore
15+
onClick={onClick}
16+
dataTest="test"
17+
type={TYPE_OPTIONS.APPSTORE}
18+
href="#"
19+
alt="Download on the App Store"
20+
/>,
1521
);
1622
expect(screen.getByTestId("test")).toBeInTheDocument();
1723
const link = screen.getByRole("link");

packages/orbit-components/src/ButtonMobileStore/types.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface Props extends Common.Globals {
1010
readonly type?: Type;
1111
readonly stopPropagation?: boolean;
1212
readonly href?: string;
13-
readonly alt?: string;
13+
readonly alt: string;
1414
readonly title?: string;
1515
readonly lang?: string;
1616
readonly onClick?: (ev: React.MouseEvent<HTMLAnchorElement>) => void;

0 commit comments

Comments
 (0)