Skip to content

Commit

Permalink
Merge pull request #277 from open-formulieren/issue/2254-conditionall…
Browse files Browse the repository at this point in the history
…y-render-language-selection-component

Conditionally render language selection component
  • Loading branch information
sergei-maertens authored Nov 10, 2022
2 parents 33c6e82 + 285208c commit 53a818e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Form from 'components/Form';
import { Layout, LayoutRow } from 'components/Layout';
import ManageAppointment from 'components/appointments/ManageAppointment';
import LanguageSelection from 'components/LanguageSelection';
import Types from 'types';


const LanguageSwitcher = ({ target = null }) => (
Expand All @@ -27,9 +28,10 @@ LanguageSwitcher.propTypes = {
Top level router - routing between an actual form or supporting screens.
*/
const App = ({ languageSelectorTarget, ...props }) => {
const { form: { translationEnabled } } = props;
return (
<Layout>
<LanguageSwitcher target={languageSelectorTarget} />
{ translationEnabled ? <LanguageSwitcher target={languageSelectorTarget} /> : null }

<LayoutRow>

Expand All @@ -50,6 +52,7 @@ const App = ({ languageSelectorTarget, ...props }) => {

App.propTypes = {
languageSelectorTarget: PropTypes.instanceOf(Element),
form: Types.Form,
};

export default App;
2 changes: 1 addition & 1 deletion src/sdk.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const FORM = {
explanationTemplate: '',
requiredFieldsWithAsterisk: true,
autoLoginAuthenticationBackend: '',
i18nEnabled: true,
translationEnabled: true,
};

const LANGUAGE_INFO = {
Expand Down

0 comments on commit 53a818e

Please sign in to comment.