forked from DeviceFarmer/stf
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from VKCOM/o.shcherbakov/modal/QA-15689
feat(ui): add modal component & upgrade vkui to v7
- Loading branch information
Showing
19 changed files
with
107 additions
and
49 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import type { AppearanceType } from '@vkontakte/vkui' | ||
import type { ColorSchemeType } from '@vkontakte/vkui' | ||
|
||
export type Theme = AppearanceType | 'system' | ||
export type Theme = ColorSchemeType | 'system' |
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 @@ | ||
export { Modal } from './modal' |
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,7 @@ | ||
.modal { | ||
width: fit-content; | ||
} | ||
|
||
.modalActions { | ||
width: 100%; | ||
} |
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,53 @@ | ||
import { useTranslation } from 'react-i18next' | ||
import { Icon20ErrorCircleFillYellow } from '@vkontakte/icons' | ||
import { Button, ButtonGroup, ModalCard, ModalRoot } from '@vkontakte/vkui' | ||
|
||
import { ConditionalRender } from '@/components/lib/conditional-render' | ||
|
||
import styles from './modal.module.css' | ||
|
||
type ModalProps = { | ||
isOpen: boolean | ||
title: string | ||
description?: string | ||
isCancelShown?: boolean | ||
onOk?: () => void | ||
onClose: () => void | ||
} | ||
|
||
export const Modal = ({ isOpen, title, description, onOk, onClose, isCancelShown = true }: ModalProps) => { | ||
const { t } = useTranslation() | ||
|
||
const onOkClick = () => { | ||
onOk?.() | ||
onClose() | ||
} | ||
|
||
return ( | ||
<ModalRoot activeModal={isOpen ? 'modal-card' : null} usePortal onClose={onClose}> | ||
<ModalCard | ||
className={styles.modal} | ||
description={description} | ||
dismissButtonMode='inside' | ||
icon={<Icon20ErrorCircleFillYellow height={56} width={56} />} | ||
id='modal-card' | ||
open={isOpen} | ||
size={900} | ||
title={title} | ||
actions={ | ||
<ButtonGroup align='right' className={styles.modalActions}> | ||
<Button mode={isCancelShown ? 'secondary' : 'primary'} size='l' onClick={onOkClick}> | ||
OK | ||
</Button> | ||
<ConditionalRender conditions={[isCancelShown]}> | ||
<Button mode='primary' size='l' onClick={onClose}> | ||
{t('Cancel')} | ||
</Button> | ||
</ConditionalRender> | ||
</ButtonGroup> | ||
} | ||
onClose={onClose} | ||
/> | ||
</ModalRoot> | ||
) | ||
} |
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,10 @@ | ||
.tabsPanel { | ||
:global(._in_sa4kt_20) { | ||
justify-content: flex-start; | ||
} | ||
|
||
:global(.vkuiInternalPanelHeader__before) { | ||
flex-grow: 0; | ||
padding: 5px; | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
:root { | ||
/* z-index */ | ||
--header-z-index: 150; | ||
--header-z-index: 99; | ||
--screen-input-z-index: 10; | ||
|
||
/* Colors */ | ||
|