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: remove deprecated react defaultProps #1442

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 3 additions & 14 deletions packages/dm-core-plugins/src/common/Stack/Stack.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { StyledStack } from './styles'
import { StackProps } from './types'
import { StackProps, defaultProps } from './types'

export const Stack = (props: StackProps) => {
const { grow, shrink, direction, wrap, ...restProps } = props
const mergedProps = { ...defaultProps, ...props }
const { grow, shrink, direction, wrap, ...restProps } = mergedProps
return (
<StyledStack
flexDirection={direction}
Expand All @@ -13,15 +14,3 @@ export const Stack = (props: StackProps) => {
/>
)
}

Stack.defaultProps = {
direction: 'column',
alignContent: 'initial',
alignItems: 'initial',
alignSelf: 'initial',
justifyContent: 'initial',
wrap: 'initial',
padding: 0,
grow: 0,
shrink: 0,
}
12 changes: 12 additions & 0 deletions packages/dm-core-plugins/src/common/Stack/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,15 @@ export interface StyledStackProps {
spacing?: number
flexWrap?: 'initial' | 'no-wrap' | 'wrap' | 'wrap-reverse'
}

export const defaultProps: StackProps = {
direction: 'column',
alignContent: 'initial',
alignItems: 'initial',
alignSelf: 'initial',
justifyContent: 'initial',
wrap: 'initial',
padding: 0,
grow: 0,
shrink: 0,
}
Loading