Skip to content

Commit

Permalink
[NO JIRA][BpkSpinner]: Updating TS types and removing propTypes ahead…
Browse files Browse the repository at this point in the history
… of React 18 (#3586)
  • Loading branch information
olliecurtis authored Aug 16, 2024
1 parent c39ca0a commit 55cea4a
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* limitations under the License.
*/

/* @flow strict */

import { render } from '@testing-library/react';

import BpkExtraLargeSpinner from './BpkExtraLargeSpinner';
Expand Down
28 changes: 9 additions & 19 deletions packages/bpk-component-spinner/src/BpkExtraLargeSpinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* limitations under the License.
*/

import PropTypes from 'prop-types';

import XlSpinner from '@skyscanner/bpk-svgs/dist/js/spinners/xl';

import { cssModules } from '../../bpk-react-utils';
Expand All @@ -31,12 +29,16 @@ import STYLES from './BpkSpinner.module.scss';
const getClassName = cssModules(STYLES);

type Props = {
type: SpinnerTypes,
className?: string,
type?: SpinnerTypes;
className?: string | null;
[rest: string]: any;
};

const BpkExtraLargeSpinner = (props: Props) => {
const { className, type, ...rest } = props;
const BpkExtraLargeSpinner = ({
className = null,
type = SPINNER_TYPES.dark,
...rest
}: Props) => {
const classNames = getClassName(
'bpk-spinner',
'bpk-spinner--extra-large',
Expand All @@ -46,21 +48,9 @@ const BpkExtraLargeSpinner = (props: Props) => {

return (
<span className={classNames}>
<XlSpinner
{...rest}
/>
<XlSpinner {...rest} />
</span>
);
};

BpkExtraLargeSpinner.propTypes = {
type: PropTypes.oneOf(Object.keys(SPINNER_TYPES)),
className: PropTypes.string,
};

BpkExtraLargeSpinner.defaultProps = {
type: SPINNER_TYPES.dark,
className: null,
};

export default BpkExtraLargeSpinner;
29 changes: 10 additions & 19 deletions packages/bpk-component-spinner/src/BpkLargeSpinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* limitations under the License.
*/

import PropTypes from 'prop-types';

import LgSpinner from '@skyscanner/bpk-svgs/dist/js/spinners/lg';

import { cssModules } from '../../bpk-react-utils';
Expand All @@ -31,13 +29,18 @@ import STYLES from './BpkSpinner.module.scss';
const getClassName = cssModules(STYLES);

type Props = {
type: SpinnerTypes,
className?: string,
alignToButton: boolean,
type?: SpinnerTypes,
className?: string | null,
alignToButton?: boolean,
[rest: string]: any,
};

const BpkLargeSpinner = (props: Props) => {
const { alignToButton, className, type, ...rest } = props;
const BpkLargeSpinner = ({
alignToButton = false,
className = null,
type = SPINNER_TYPES.dark,
...rest
}: Props) => {

const classNames = getClassName(
'bpk-spinner',
Expand All @@ -57,16 +60,4 @@ const BpkLargeSpinner = (props: Props) => {
);
};

BpkLargeSpinner.propTypes = {
type: PropTypes.oneOf(Object.keys(SPINNER_TYPES)),
className: PropTypes.string,
alignToButton: PropTypes.bool,
};

BpkLargeSpinner.defaultProps = {
type: SPINNER_TYPES.dark,
className: null,
alignToButton: false,
};

export default BpkLargeSpinner;
35 changes: 11 additions & 24 deletions packages/bpk-component-spinner/src/BpkSpinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
* limitations under the License.
*/


import PropTypes from 'prop-types';

import SmSpinner from '@skyscanner/bpk-svgs/dist/js/spinners/sm';

import { cssModules } from '../../bpk-react-utils';
Expand All @@ -32,14 +29,18 @@ import STYLES from './BpkSpinner.module.scss';
const getClassName = cssModules(STYLES);

type Props = {
type: SpinnerTypes,
className?: string,
alignToButton: boolean,
type?: SpinnerTypes;
className?: string | null;
alignToButton?: boolean;
[rest: string]: any;
};

const BpkSpinner = (props: Props) => {
const { alignToButton, className, type, ...rest } = props;

const BpkSpinner = ({
alignToButton = false,
className = null,
type = SPINNER_TYPES.dark,
...rest
}: Props) => {
const classNames = getClassName(
'bpk-spinner',
`bpk-spinner--${type}`,
Expand All @@ -49,23 +50,9 @@ const BpkSpinner = (props: Props) => {

return (
<span className={classNames}>
<SmSpinner
{...rest}
/>
<SmSpinner {...rest} />
</span>
);
};

BpkSpinner.propTypes = {
type: PropTypes.oneOf(Object.keys(SPINNER_TYPES)),
className: PropTypes.string,
alignToButton: PropTypes.bool,
};

BpkSpinner.defaultProps = {
type: SPINNER_TYPES.dark,
className: null,
alignToButton: false,
};

export default BpkSpinner;

0 comments on commit 55cea4a

Please sign in to comment.