Skip to content

Commit

Permalink
fix: small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
flaminic committed Oct 16, 2024
1 parent 9b8809d commit 1f4c41d
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions src/config/field-overrides/dataSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class RenderAsTabsSettings extends React.Component {
const addCustomText = event.target.value
const customText =
addCustomText
? {header: undefined, subheader: undefined, alignemt: 'center'}
? {header: undefined, subheader: undefined, align: 'center'}
: undefined

const newDisplayOptions = {
Expand All @@ -75,9 +75,9 @@ class RenderAsTabsSettings extends React.Component {
this.updateDisplayOption(newDisplayOptions)
}

onCustomTextAlignmentChanged = (event) => {
onCustomTextChanged = (event, field) => {
const customText =
{...this.state.displayOptions.customText, align: event.target.value}
{...this.state.displayOptions.customText, [field]: event.target.value}

const newDisplayOptions = {
...this.state.displayOptions,
Expand All @@ -86,27 +86,17 @@ class RenderAsTabsSettings extends React.Component {
this.updateDisplayOption(newDisplayOptions)
}

onCustomTextAlignmentChanged = (event) => {
this.onCustomTextChanged(event, 'align')
}

onCustomTextHeaderChanged = (event) => {
const customText =
{...this.state.displayOptions.customText, header: event.target.value}

const newDisplayOptions = {
...this.state.displayOptions,
customText
}
this.updateDisplayOption(newDisplayOptions)
onCustomTextHeaderChanged = (event) => {
this.onCustomTextChanged(event, 'header')
}

onCustomTextSubheaderChanged = (event) => {
const customText =
{...this.state.displayOptions.customText, subheader: event.target.value}

const newDisplayOptions = {
...this.state.displayOptions,
customText
}
this.updateDisplayOption(newDisplayOptions)
this.onCustomTextChanged(event, 'subheader')
}

render() {
Expand Down Expand Up @@ -157,7 +147,7 @@ class RenderAsTabsSettings extends React.Component {
onChange={this.onCustomTextAlignmentChanged}
name="customTextAlignment"
defaultSelected={
(state.displayOptions && state.displayOptions.customText && state.displayOptions.customText.align) || 'left'}
(state.displayOptions && state.displayOptions.customText && state.displayOptions.customText.align) || 'center'}
>
<RadioButton
key='left'
Expand All @@ -182,14 +172,14 @@ class RenderAsTabsSettings extends React.Component {
{state.displayOptions && state.displayOptions.customText &&
<div style={customTextCssStyles}>
<TextField
value={(this.state.displayOptions && state.displayOptions.customText &&
value={(state.displayOptions && state.displayOptions.customText &&
state.displayOptions.customText.header) || ""}
fullWidth={false}
onChange={this.onCustomTextHeaderChanged}
floatingLabelText={this.translate('data_set_title')}
/>
<TextField
value={(this.state.displayOptions && state.displayOptions.customText &&
value={(state.displayOptions && state.displayOptions.customText &&
state.displayOptions.customText.subheader) || ""}
fullWidth={false}
onChange={this.onCustomTextSubheaderChanged}
Expand Down

0 comments on commit 1f4c41d

Please sign in to comment.