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

chore: side add type specification #6258

Merged
merged 1 commit into from
Jul 28, 2023
Merged
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
8 changes: 5 additions & 3 deletions src/components/swipe-action/swipe-action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import {

const classPrefix = `adm-swipe-action`

type SideType = 'left' | 'right'

export type SwipeActionRef = {
close: () => void
show: (side?: 'left' | 'right') => void
show: (side?: SideType) => void
}

type ActionColor =
Expand All @@ -47,7 +49,7 @@ export type SwipeActionProps = {
closeOnAction?: boolean
children: ReactNode
stopPropagation?: PropagationEvent[]
onActionsReveal?: (side: 'left' | 'right') => void
onActionsReveal?: (side: SideType) => void
} & NativeProps<'--background'>

const defaultProps = {
Expand Down Expand Up @@ -157,7 +159,7 @@ export const SwipeAction = forwardRef<SwipeActionRef, SwipeActionProps>(
}

useImperativeHandle(ref, () => ({
show: (side: 'left' | 'right' = 'right') => {
show: (side: SideType = 'right') => {
if (side === 'right') {
api.start({
x: -getRightWidth(),
Expand Down