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

fix: new modal animation #139

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions packages/desktop/src/modal/SimpleModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const contentTransition: FunctionComponent<SimpleTransitionProps> = (props) => <

contentTransition.defaultProps = {
timeout: {
enter: 370,
exit: 250,
enter: 300,
exit: 150,
},
enterClassName: (timeout: number) => css({
opacity: 1,
Expand All @@ -29,7 +29,7 @@ contentTransition.defaultProps = {
}),
exitClassName: (timeout: number) => css({
opacity: 0,
transform: 'translate3d(0, 35px, 0)',
transform: 'translate3d(0, 28px, 0)',
transition: `opacity ${timeout}ms ease, transform ${timeout}ms ease`,
}),
}
Expand All @@ -38,8 +38,8 @@ const backdropTransition: FunctionComponent<SimpleTransitionProps> = (props) =>

backdropTransition.defaultProps = {
timeout: {
enter: 370,
exit: 250,
enter: 300,
exit: 200,
},
enterClassName: (timeout: number) => css({
opacity: 1,
Expand Down
200 changes: 200 additions & 0 deletions packages/mobile/src/modal/SimpleModal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
Рекомендуемый размер заголовка [H2](#/Компоненты/Heading) с основным текстом [Body M]() (Normal).

В окнах применяются [Brand Button](#/Компоненты/Button) и [Simple Button](#/Компоненты/Button) в размере Normal.

```jsx
<Box>
<Actions size="normal">
<Button
kind="simple"
size="normal"
type="button"
text="Показать окно"
onClick={() => setState({delete: true})}
/>
</Actions>
<SimpleModal
show={state.delete}
size={'m'}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size="m"

closable
backdropClose
onHide={() => setState({delete: false})}
children={
<Spacer size="xl">
<Heading size="2">Удалить из избранного?</Heading>
<Actions size="normal">
<Button
kind="brand"
size="normal"
type="button"
text="Удалить"
onClick={() => setState({delete: false})}
/>
<Button
kind="simple"
size="normal"
type="button"
text="Отменить"
onClick={() => setState({delete: false})}
/>
</Actions>
</Spacer>
}
/>
</Box>
```



## Примеры окон

#### Заголовок, описание и кнопки

```jsx
<Box>
<Actions size="normal">
<Button
kind="simple"
size="normal"
type="button"
text="Открыть"
onClick={() => setState({notification: true})}
/>
</Actions>
<SimpleModal
show={state.notification}
size={'m'}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size="m"

closable
backdropClose
onHide={() => setState({notification: false})}
children={
<Spacer size="l">
<Spacer size="m">
<Heading size="2">Отключить уведомления?</Heading>
<Paragraph size="m">Вам перестанут приходить сообщения о пополнении и списании</Paragraph>
</Spacer>
<Actions size="normal">
<Button
kind="brand"
size="normal"
type="button"
text="Отключить уведомления"
onClick={() => setState({notification: false})}
/>
<Button
kind="simple"
size="normal"
type="button"
text="Не отключать"
onClick={() => setState({notification: false})}
/>
</Actions>
</Spacer>
}
/>
</Box>
```

#### Заголовок, инпут и кнопка

```jsx
<Box>
<Actions size="normal">
<Button
kind="simple"
size="normal"
type="button"
text="Открыть"
onClick={() => setState({email: true})}
/>
</Actions>
<SimpleModal
show={state.email}
size={'m'}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😠

closable
backdropClose
onHide={() => setState({email: false})}
children={
<Spacer size="l">
<Spacer size="l">
<Heading size="2">Куда отправить квитанцию?</Heading>
<TextField
title="Адрес элктронной почты"
type="text"
value={state.text}
onChange={text => setState({text})}
/>
</Spacer>
<Actions size="normal">
<Button
kind="brand"
size="normal"
type="button"
text="Отправить"
onClick={() => setState({email: false})}
/>
</Actions>
</Spacer>
}
/>
</Box>
```

#### Заголовок, инпут, кнопка и чекбоксы.

```jsx
initialState = {values: ['selected']};
<Box>
<Actions size="normal">
<Button
kind="simple"
size="normal"
type="button"
text="Открыть"
onClick={() => setState({snapping: true})}
/>
</Actions>
<SimpleModal
show={state.snapping}
size={'m'}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😡

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💩

closable
backdropClose
onHide={() => setState({snapping: false})}
children={
<Spacer size="l">
<Spacer size="l">
<Heading size="2">Привязка почты к QIWI Кошельку</Heading>
<TextField
title="Адрес элктронной почты"
type="text"
value={state.text}
onChange={text => setState({text})}
/>
</Spacer>
<Actions size="normal">
<Button
kind="brand"
size="normal"
type="button"
text="Привязать почту"
onClick={() => setState({snapping: false})}
/>
</Actions>
<CheckboxField
options={[{
label: 'Использовать почту для изменения пароля',
value: 'selected',
disabled: false,
}, {
label: 'Получать письма о полезных функциях и акциях от QIWI',
value: 'normal',
disabled: false,
}]}
values={state.values}
onChange={(values) => setState({values})}
/>
</Spacer>
}
/>
</Box>
```
12 changes: 6 additions & 6 deletions packages/mobile/src/modal/SimpleModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ const contentTransition: FunctionComponent<SimpleTransitionProps> = (props) => <

contentTransition.defaultProps = {
timeout: {
enter: 370,
exit: 250,
enter: 300,
exit: 150,
},
enterClassName: (timeout: number) => css({
opacity: 1,
transform: 'translate3d(0, 0, 0)',
transform: 'scale(1.0)',
transition: `opacity ${timeout}ms ease, transform ${timeout}ms ease`,
}),
exitClassName: (timeout: number) => css({
opacity: 0,
transform: 'translate3d(0, -100%, 0)',
transform: 'scale(0.94)',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

посмотри как работает рекапча в модалке размером s

transition: `opacity ${timeout}ms ease, transform ${timeout}ms ease`,
}),
}
Expand All @@ -38,8 +38,8 @@ const backdropTransition: FunctionComponent<SimpleTransitionProps> = (props) =>

backdropTransition.defaultProps = {
timeout: {
enter: 370,
exit: 250,
enter: 200,
exit: 200,
},
enterClassName: (timeout: number) => css({
opacity: 1,
Expand Down