-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Localized exercise name with other locales shown as a hint created.
- Loading branch information
Martin Krulis
committed
Nov 7, 2017
1 parent
0df5a9a
commit d532675
Showing
17 changed files
with
147 additions
and
115 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
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
43 changes: 43 additions & 0 deletions
43
src/components/helpers/LocalizedExerciseName/LocalizedExerciseName.js
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,43 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { injectIntl } from 'react-intl'; | ||
import { OverlayTrigger, Tooltip } from 'react-bootstrap'; | ||
import Icon from 'react-fontawesome'; | ||
|
||
import { | ||
getLocalizedName, | ||
getOtherLocalizedNames | ||
} from '../../../helpers/getLocalizedData'; | ||
|
||
const LocalizedExerciseName = ({ entity, intl: { locale } }) => { | ||
const otherNames = getOtherLocalizedNames(entity, locale); | ||
return ( | ||
<span> | ||
{getLocalizedName(entity, locale)} | ||
{otherNames.length > 0 && | ||
<span> | ||
<OverlayTrigger | ||
placement="right" | ||
overlay={ | ||
<Tooltip id={otherNames.map(n => n.name).join(', ')}> | ||
{otherNames.map(name => | ||
<div key={entity.id + '.nametooltip.' + name.locale}> | ||
<strong>{name.name}</strong> [{name.locale}] | ||
</div> | ||
)} | ||
</Tooltip> | ||
} | ||
> | ||
<Icon name="flag-o" className="text-black" /> | ||
</OverlayTrigger> | ||
</span>} | ||
</span> | ||
); | ||
}; | ||
|
||
LocalizedExerciseName.propTypes = { | ||
entity: PropTypes.object, | ||
intl: PropTypes.shape({ locale: PropTypes.string.isRequired }).isRequired | ||
}; | ||
|
||
export default injectIntl(LocalizedExerciseName); |
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 default from './LocalizedExerciseName'; |
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.