-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into piyush/refactor-collections-reducers-acti…
…ons-redux-toolkit
- Loading branch information
Showing
68 changed files
with
649 additions
and
644 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { useState } from 'react'; | ||
import classNames from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
const SkipLink = ({ targetId, text }) => { | ||
const [focus, setFocus] = useState(false); | ||
const { t } = useTranslation(); | ||
const handleFocus = () => { | ||
setFocus(true); | ||
}; | ||
|
||
const handleBlur = () => { | ||
setFocus(false); | ||
}; | ||
const linkClasses = classNames('skip_link', { focus }); | ||
|
||
return ( | ||
<a | ||
href={`#${targetId}`} | ||
className={linkClasses} | ||
onFocus={handleFocus} | ||
onBlur={handleBlur} | ||
> | ||
{t(`SkipLink.${text}`)} | ||
</a> | ||
); | ||
}; | ||
|
||
SkipLink.propTypes = { | ||
targetId: PropTypes.string.isRequired, | ||
text: PropTypes.string.isRequired | ||
}; | ||
|
||
export default SkipLink; |
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,29 +1,24 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import browserHistory from '../browserHistory'; | ||
import { useEffect } from 'react'; | ||
import { useSelector } from 'react-redux'; | ||
import { useHistory } from 'react-router-dom'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const RedirectToUser = ({ username, url = '/:username/sketches' }) => { | ||
React.useEffect(() => { | ||
if (username == null) { | ||
return; | ||
const RedirectToUser = ({ url = '/:username/sketches' }) => { | ||
const history = useHistory(); | ||
const username = useSelector((state) => | ||
state.user ? state.user.username : null | ||
); | ||
useEffect(() => { | ||
if (username) { | ||
history.replace(url.replace(':username', username)); | ||
} | ||
|
||
browserHistory.replace(url.replace(':username', username)); | ||
}, [username]); | ||
}, [history, url, username]); | ||
|
||
return null; | ||
}; | ||
|
||
function mapStateToProps(state) { | ||
return { | ||
username: state.user ? state.user.username : null | ||
}; | ||
} | ||
|
||
const ConnectedRedirectToUser = connect(mapStateToProps)(RedirectToUser); | ||
|
||
const createRedirectWithUsername = (url) => (props) => ( | ||
<ConnectedRedirectToUser {...props} url={url} /> | ||
); | ||
RedirectToUser.propTypes = { | ||
url: PropTypes.string.isRequired | ||
}; | ||
|
||
export default createRedirectWithUsername; | ||
export default RedirectToUser; |
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,14 +1 @@ | ||
import * as ActionTypes from '../../../constants'; | ||
|
||
export function clearConsole() { | ||
return { | ||
type: ActionTypes.CLEAR_CONSOLE | ||
}; | ||
} | ||
|
||
export function dispatchConsoleEvent(messages) { | ||
return { | ||
type: ActionTypes.CONSOLE_EVENT, | ||
event: messages | ||
}; | ||
} | ||
export { dispatchConsoleEvent, clearConsole } from '../reducers/console'; |
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
Oops, something went wrong.