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

refactor: Destructure default props #525

Merged
merged 51 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ed8c79f
chore: Destructure default props
mannycarrera4 Mar 18, 2020
1d00da0
chore: Destructure props for modal
mannycarrera4 Mar 18, 2020
51cf87a
fix: Make props optional in modal content
mannycarrera4 Mar 18, 2020
dd1d73c
fix: Update optional prop for combobox
mannycarrera4 Mar 19, 2020
a760d03
fix: Update default props for drawer and combo
mannycarrera4 Mar 19, 2020
a59071f
fix: Update aria label prop name
mannycarrera4 Mar 19, 2020
0359591
fix: Destructure props for drawer header
mannycarrera4 Mar 19, 2020
ad52580
fix: Destructure search box default props
mannycarrera4 Mar 19, 2020
57782f1
fix: Destructure props for header
mannycarrera4 Mar 19, 2020
ae1c3e4
fix: Destructure default props for menu item
mannycarrera4 Mar 19, 2020
7000d21
fix: Fix merge conflict with menu item
mannycarrera4 Mar 19, 2020
faf7616
fix: Destructure default props for menu item and pagination
mannycarrera4 Mar 19, 2020
7e036cd
fix: Destructure default props for menu avatar banner
mannycarrera4 Mar 19, 2020
214f13a
fix: Destructure props for avatar button card checkbox colorinput
mannycarrera4 Mar 19, 2020
4c4da79
fix: Destructure textbutton popper cookie banner fomfield hint label
mannycarrera4 Mar 19, 2020
430dd5b
fix: Destructure props for radio radigroup select
mannycarrera4 Mar 19, 2020
1015195
fix: Destructure for page header layout
mannycarrera4 Mar 20, 2020
3f610c6
fix: Destructure selec option sidepanel skeleton status
mannycarrera4 Mar 20, 2020
6e723d8
fix: Destructure button switch text area text input toast tooltip
mannycarrera4 Mar 20, 2020
879fdea
fix: Destructure props for different buttons and popper
mannycarrera4 Mar 20, 2020
3b6dbfd
fix: Update readme and component props
mannycarrera4 Mar 20, 2020
ce12722
fix: Update menu test and default prop for card
mannycarrera4 Mar 23, 2020
ac52c87
fix: Update icons props
mannycarrera4 Mar 23, 2020
7f5ae2d
test: Update classname prop for svg
mannycarrera4 Mar 23, 2020
69da57a
test: Revert files with failing tests
mannycarrera4 Mar 23, 2020
1fbe477
fix: Add padding as optional for card
mannycarrera4 Mar 25, 2020
5150eed
fix: Revert tooltip changes
mannycarrera4 Mar 25, 2020
11931c8
fix: Fix merge conflicts
mannycarrera4 Mar 25, 2020
2a81713
fix: Update default props for pagination
mannycarrera4 Mar 26, 2020
d9a9546
fix: Fix default props for system icons
mannycarrera4 Mar 26, 2020
3c29a85
fix: Destrcutrue props for menuitem
mannycarrera4 Mar 26, 2020
1b726d3
fix: Add todo for menuitem
mannycarrera4 Mar 26, 2020
47fc1f3
fix: Update props to bring to top and use new type
mannycarrera4 Mar 27, 2020
b180faf
fix: Reformat props
mannycarrera4 Mar 27, 2020
2be75fa
fix: Move defaults to the top
mannycarrera4 Mar 30, 2020
c5c875b
fix: Update default props to the top
mannycarrera4 Mar 30, 2020
55ee59c
fix: Update toast default props
mannycarrera4 Mar 30, 2020
b255f20
fix: Resolve popup conflicts
mannycarrera4 Mar 30, 2020
b6d65a2
fix: Fix storybook errors
mannycarrera4 Mar 30, 2020
5147ae6
fix: Update capwidth default prop
mannycarrera4 Mar 31, 2020
6e185e2
fix: Update comment
mannycarrera4 Mar 31, 2020
f84b2de
fix: Update popup type
mannycarrera4 Mar 31, 2020
953687b
fix: Pass prop down to label for proper styling
mannycarrera4 Mar 31, 2020
736ce06
fix: Address comments, fix test
mannycarrera4 Apr 1, 2020
d7d41b9
fix: Clean up props for modal and toast and header
mannycarrera4 Apr 2, 2020
d014e45
Merge branch 'prerelease/v4' into mc-destructure-props
mannycarrera4 Apr 2, 2020
1877712
fix: Update after merge conflicts
mannycarrera4 Apr 2, 2020
255f688
fix: Remove defaults for popup
mannycarrera4 Apr 6, 2020
06a6440
fix: Update modal props
mannycarrera4 Apr 6, 2020
700662c
Merge branch 'prerelease/v4' into mc-destructure-props
anicholls Apr 6, 2020
39d9408
Merge branch 'prerelease/v4' into mc-destructure-props
mannycarrera4 Apr 7, 2020
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
10 changes: 3 additions & 7 deletions modules/_labs/combobox/react/lib/Combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ export default class Combobox extends React.Component<ComboboxProps, ComboboxSta
private comboboxRef = React.createRef<HTMLDivElement>();
private id = uuid();

static defaultProps = {
clearButtonLabel: `Reset Search Input`,
clearButtonVariant: IconButton.Variant.Plain,
};

state: Readonly<ComboboxState> = {
isFocused: false,
value: '',
Expand Down Expand Up @@ -364,7 +359,7 @@ export default class Combobox extends React.Component<ComboboxProps, ComboboxSta
const {
autocompleteItems,
children,
clearButtonVariant,
clearButtonVariant = IconButton.Variant.Plain,
grow,
id = this.id,
initialValue,
Expand All @@ -373,6 +368,7 @@ export default class Combobox extends React.Component<ComboboxProps, ComboboxSta
onBlur,
showClearButton,
labelId,
clearButtonLabel = 'Reset Search Input',
...elemProps
} = this.props;

Expand All @@ -383,7 +379,7 @@ export default class Combobox extends React.Component<ComboboxProps, ComboboxSta
{showClearButton && (
<ResetButton
shouldShow={!!this.state.value}
aria-label={this.props.clearButtonLabel}
aria-label={clearButtonLabel}
icon={xSmallIcon}
variant={clearButtonVariant}
toggled={undefined}
Expand Down
24 changes: 15 additions & 9 deletions modules/modal/react/lib/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,25 @@ export interface ModalProps extends ModalContentProps {
open: boolean;
}

const Modal = ({open, ...modalContentProps}: ModalProps): JSX.Element | null =>
open ? <ModalContent {...modalContentProps} /> : null;
const Modal = ({
open = false,
padding = PopupPadding.l,
width = ModalWidth.s,
closeOnEscape = true,
...modalContentProps
}: ModalProps): JSX.Element | null =>
open ? (
<ModalContent
padding={padding}
width={width}
closeOnEscape={closeOnEscape}
{...modalContentProps}
/>
) : null;

Modal.Padding = PopupPadding;
Modal.Width = ModalWidth;

Modal.defaultProps = {
open: false,
padding: Modal.Padding.l,
width: Modal.Width.s,
closeOnEscape: true,
};

export default Modal;

/**
Expand Down