Skip to content

Commit f2c4d00

Browse files
authored
Merge pull request #243 from DakaraProject/refactor/transition2
Change transition library
2 parents 1ddd8f8 + 8260916 commit f2c4d00

62 files changed

Lines changed: 708 additions & 815 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default [
7070
['^\\u0000'],
7171
['^@?\\w'],
7272
[
73-
'^(actions|components|eventManagers|middleware|permissions|reducers|serverPropTypes|style|thirdpartyExtensions|utils)',
73+
'^(actions|components|contexts|eventManagers|middleware|permissions|reducers|serverPropTypes|style|utils)',
7474
],
7575
['^'],
7676
['^\\.'],

package-lock.json

Lines changed: 10 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"react-highlight-words": "^0.21.0",
4343
"react-redux": "^9.2.0",
4444
"react-router": "^7.12.0",
45-
"react-transition-group": "^4.4.5",
45+
"react-transitioning": "^1.0.9",
4646
"redux": "^5.0.1",
4747
"redux-localstorage": "^0.4.1",
4848
"redux-thunk": "^3.1.0",

src/actions/users.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const USER_LIST_FAILURE = 'USER_LIST_FAILURE'
2828
*/
2929
const refreshUsersDelayed = (dispatch, getState) => {
3030
const page = getState().settings.users.list.data.pagination.current
31-
return dispatch(delay(loadUsers({ page }), 3000))
31+
return dispatch(delay(loadUsers(page), 3000))
3232
}
3333

3434
/**
Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,65 @@
11
import PropTypes from 'prop-types'
22

3+
import Slide from 'components/transitions/Slide'
4+
35
export default function ConfirmationBar({
46
message = 'Are you sure?',
7+
show,
8+
setShow,
59
onCancel,
610
onConfirm,
11+
hideOnCancel = true,
12+
hideOnConfirm = false,
713
}) {
814
return (
9-
<div className="notified">
10-
<div className="notification warning">
11-
<div className="message">{message}</div>
12-
<div className="controls compact">
13-
<button
14-
onClick={() => {
15-
onConfirm()
16-
}}
17-
className="control square success"
18-
>
19-
<span className="icon">
20-
<i className="las la-check"></i>
21-
</span>
22-
</button>
23-
<button
24-
onClick={() => {
25-
onCancel()
26-
}}
27-
className="control square danger"
28-
>
29-
<span className="icon">
30-
<i className="las la-times"></i>
31-
</span>
32-
</button>
15+
<Slide in={show}>
16+
<div className="confirmation-bar notified transition">
17+
<div className="notification warning">
18+
<div className="message">{message}</div>
19+
<div className="controls compact">
20+
<button
21+
onClick={() => {
22+
if (hideOnConfirm) {
23+
setShow(false)
24+
}
25+
if (typeof onConfirm === 'function') {
26+
onConfirm()
27+
}
28+
}}
29+
className="control square success"
30+
>
31+
<span className="icon">
32+
<i className="las la-check"></i>
33+
</span>
34+
</button>
35+
<button
36+
onClick={() => {
37+
if (hideOnCancel) {
38+
setShow(false)
39+
}
40+
if (typeof onCancel === 'function') {
41+
onCancel()
42+
}
43+
}}
44+
className="control square danger"
45+
>
46+
<span className="icon">
47+
<i className="las la-times"></i>
48+
</span>
49+
</button>
50+
</div>
3351
</div>
3452
</div>
35-
</div>
53+
</Slide>
3654
)
3755
}
3856

3957
ConfirmationBar.propTypes = {
4058
message: PropTypes.string,
41-
onCancel: PropTypes.func.isRequired,
42-
onConfirm: PropTypes.func.isRequired,
59+
show: PropTypes.bool,
60+
setShow: PropTypes.func.isRequired,
61+
onCancel: PropTypes.func,
62+
onConfirm: PropTypes.func,
63+
hideOnCancel: PropTypes.bool,
64+
hideOnConfirm: PropTypes.bool,
4365
}

src/components/generics/Details.jsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import classNames from 'classnames'
22
import PropTypes from 'prop-types'
33
import { useState } from 'react'
4-
import { CSSTransition } from 'react-transition-group'
54

5+
import Collapse from 'components/transitions/Collapse'
66
import { isDisplayable } from 'utils'
77

88
export function Details({ children }) {
@@ -69,17 +69,11 @@ export function DetailLongText({
6969
notifiable: isDisplayable(notifications),
7070
})}
7171
>
72-
<CSSTransition
73-
classNames="reveal"
74-
in={revealed}
75-
timeout={{
76-
enter: 300,
77-
}}
78-
>
79-
<div className="border">
72+
<Collapse in={revealed} exit={false} alwaysMounted>
73+
<div className="border transition">
8074
<p className="paragraph">{children}</p>
8175
</div>
82-
</CSSTransition>
76+
</Collapse>
8377
{!revealed && (
8478
<div className="controls">
8579
<button

src/components/generics/Form.jsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import classNames from 'classnames'
22
import PropTypes from 'prop-types'
33
import React, { Component } from 'react'
44
import { connect } from 'react-redux'
5-
import { CSSTransition, TransitionGroup } from 'react-transition-group'
5+
import { TransitionGroup } from 'react-transitioning'
66

77
import {
88
clearAlteration,
99
setAlterationValidationErrors,
1010
submitAlteration,
1111
} from 'actions/alterations'
12-
import Notification from 'components/generics/Notification'
12+
import NotificationBar from 'components/generics/NotificationBar'
13+
import Collapse from 'components/transitions/Collapse'
1314
import {
1415
alterationResponsePropType,
1516
Status,
@@ -387,7 +388,7 @@ class FormBlock extends Form {
387388
{header}
388389
{fieldsSet}
389390
<div className="controls compact notifiable">
390-
<Notification
391+
<NotificationBar
391392
alterationResponse={alterationResponse}
392393
successfulMessage={successMessage}
393394
failedMessage={failedMessage}
@@ -568,15 +569,9 @@ class Field extends Component {
568569
))
569570

570571
fieldErrorMessages = (
571-
<CSSTransition
572-
classNames="error-container"
573-
timeout={{
574-
enter: 300,
575-
exit: 150,
576-
}}
577-
>
578-
<div className="error-container">{fieldErrorContent}</div>
579-
</CSSTransition>
572+
<Collapse>
573+
<div className="error-container transition">{fieldErrorContent}</div>
574+
</Collapse>
580575
)
581576
}
582577

@@ -612,7 +607,9 @@ class Field extends Component {
612607
</label>
613608
<div className="input">
614609
{this.subRender(props)}
615-
<TransitionGroup>{fieldErrorMessages}</TransitionGroup>
610+
<TransitionGroup enter exit>
611+
{fieldErrorMessages}
612+
</TransitionGroup>
616613
</div>
617614
</div>
618615
)

0 commit comments

Comments
 (0)