Skip to content

Commit

Permalink
NO-JIRA: Added submit to loading button props (#3574)
Browse files Browse the repository at this point in the history
* added submit to loading button props

* linting

* added examples for submit buttons

* moved loading button example

* moved submit button

---------

Co-authored-by: Amber Shand <amber.shand@skyscanner.net>
  • Loading branch information
amburrrshand and ambershand authored Aug 6, 2024
1 parent 5169c23 commit 52c4847
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions examples/bpk-component-button/examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ const FullWidthExample = (props: any) => (
</BpkButtonV2>
);

const SubmitButtonExample = (props: any) => (
<BpkButtonV2 submit {...props}>
Submit Button
</BpkButtonV2>
);

const MixedExample = () => (
<>
<PrimaryExample />
Expand All @@ -188,6 +194,7 @@ const MixedExample = () => (
<LinkOnDarkExample />
<FeaturedExample />
<FullWidthExample />
<SubmitButtonExample />
</>
);

Expand Down Expand Up @@ -218,4 +225,5 @@ export {
MixedExample,
AnchorTagsExample,
FullWidthExample,
SubmitButtonExample,
};
3 changes: 2 additions & 1 deletion examples/bpk-component-button/stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
MixedExample,
AnchorTagsExample,
FullWidthExample,
SubmitButtonExample,
} from './examples';
import { MixedExample as MixedExampleV1 } from './examplesv1';

Expand Down Expand Up @@ -75,5 +76,5 @@ export const VisualTestV1WithZoom = {
zoomEnabled: true,
},
};

export const SubmitButton = () => <SubmitButtonExample />;
export const FullWidth = () => <FullWidthExample />;
4 changes: 4 additions & 0 deletions examples/bpk-component-loading-button/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ const VisualExample = () => (
</div>
</div>
);
const SubmitExample = () => (
<LoadingButtonStory submit wrapped={BpkLoadingButton} />
);

export {
DocsPrimaryExample,
Expand All @@ -411,4 +414,5 @@ export {
AnchorTagsExample,
CustomIconExample,
VisualExample,
SubmitExample,
};
2 changes: 2 additions & 0 deletions examples/bpk-component-loading-button/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
AnchorTagsExample,
CustomIconExample,
VisualExample,
SubmitExample,
} from './examples';

export default {
Expand Down Expand Up @@ -61,6 +62,7 @@ export const Mixture = MixtureExample;
export const AnchorTags = AnchorTagsExample;

export const CustomIcon = CustomIconExample;
export const Submit = SubmitExample;
export const VisualTest = VisualExample;
export const VisualTestWithZoom = VisualTest.bind({});
VisualTestWithZoom.args = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import ArrowIconSm from '../../bpk-component-icon/sm/long-arrow-right';
import { BpkSpinner, BpkLargeSpinner } from '../../bpk-component-spinner';
import { cssModules } from '../../bpk-react-utils';

import type { Props as ButtonProps } from '../../bpk-component-button/src/BpkButtonV2/common-types';

import STYLES from './BpkLoadingButton.module.scss';

const getClassName = cssModules(STYLES);
Expand Down Expand Up @@ -83,7 +85,7 @@ type LoadingProps = {
iconPosition: string,
iconDisabled?: ReactElement<any>,
iconLoading?: ReactElement<any>,
};
} & ButtonProps;

const BpkLoadingButton = (props: LoadingProps) => {
const {
Expand Down

0 comments on commit 52c4847

Please sign in to comment.