This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(UIKIT-1781,ConfirmDialog): Исправлено отображение на мобильных у…
…стройствах (#1137)
- Loading branch information
1 parent
f3b8f7d
commit 4c4b826
Showing
5 changed files
with
52 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { styled } from '../styles'; | ||
import { Button } from '../Button'; | ||
|
||
export const CancelButton = styled(Button)` | ||
${({ theme }) => theme.breakpoints.down('sm')} { | ||
order: 1; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './useLogic'; |
23 changes: 23 additions & 0 deletions
23
packages/components/src/ConfirmDialog/useLogic/useLogic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useViewportType } from '../../hooks'; | ||
import { type ConfirmDialogProps } from '../ConfirmDialog'; | ||
|
||
type UseLogicParams = ConfirmDialogProps; | ||
|
||
export const useLogic = ({ actions, onClose }: UseLogicParams) => { | ||
const { isMobile } = useViewportType(); | ||
const { cancel } = actions; | ||
|
||
const isShowCancelButton = Boolean(cancel); | ||
|
||
const cancelVariant = isMobile ? 'light' : 'text'; | ||
const handleCancelClick = cancel?.onClick || onClose; | ||
|
||
const { variant = cancelVariant } = cancel || {}; | ||
|
||
const cancelButtonProps = { | ||
variant, | ||
onClick: handleCancelClick, | ||
}; | ||
|
||
return { isShowCancelButton, cancelButtonProps }; | ||
}; |