Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/components/containers/UpdateMenuAccordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,12 @@ class UpdateMenuAccordion extends Component {
dropdown: _('Dropdown'),
buttons: _('Buttons'),
};
const updateMenuType =
localizedType[upd.type] || localizedType.dropdown;
const activeElementLabel = upd.buttons.filter(
b => b._index === upd.active
)[0].label;
const menuType = localizedType[upd.type] || localizedType.dropdown;
const activeBtn = upd.buttons.filter(b => b._index === upd.active)[0];
const foldName = menuType + (activeBtn ? ': ' + activeBtn.label : '');

return (
<UpdateMenuFold
key={i}
updateMenuIndex={i}
name={updateMenuType + ': ' + activeElementLabel}
>
<UpdateMenuFold key={i} updateMenuIndex={i} name={foldName}>
{children}
</UpdateMenuFold>
);
Expand Down
38 changes: 37 additions & 1 deletion src/default_panels/StyleSlidersPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Numeric,
Radio,
PlotlySection,
Dropdown,
SliderAccordion,
} from '../components';

Expand All @@ -31,6 +32,41 @@ const StyleSlidersPanel = (props, {localize: _}) => (
<Numeric label={_('Size')} attr="font.size" />
<ColorPicker label={_('Color')} attr="font.color" />
</PlotlySection>
<PlotlySection name={_('Length')} attr={'len'}>
<Numeric label={_('Length')} attr={'len'} step={0.02} />
<Dropdown
label={_('Length Mode')}
attr={'lenmode'}
options={[
{label: _('Fraction of canvas'), value: 'fraction'},
{label: _('Pixels'), value: 'pixels'},
]}
/>
</PlotlySection>
<PlotlySection name={_('Horizontal Positioning')} attr={'x'}>
<Numeric label={_('Position')} attr={'x'} showSlider step={0.02} />
<Radio
label={_('Anchor')}
attr={'xanchor'}
options={[
{label: _('Left'), value: 'left'},
{label: _('Center'), value: 'center'},
{label: _('Right'), value: 'right'},
]}
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it needs to be clearable={false}, same for other 3 dropdowns.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other than that 💃

</PlotlySection>
<PlotlySection name={_('Vertical Positioning')} attr={'y'}>
<Numeric label={_('Position')} attr={'y'} showSlider step={0.02} />
<Radio
label={_('Anchor')}
attr={'yanchor'}
options={[
{label: _('Top'), value: 'top'},
{label: _('Middle'), value: 'middle'},
{label: _('Bottom'), value: 'bottom'},
]}
/>
</PlotlySection>
<PlotlySection name={_('Padding')}>
<Numeric label={_('Top')} attr="pad.t" units="px" />
<Numeric label={_('Bottom')} attr="pad.b" units="px" />
Expand All @@ -39,7 +75,7 @@ const StyleSlidersPanel = (props, {localize: _}) => (
</PlotlySection>
<PlotlySection name={_('Ticks')}>
<ColorPicker label={_('Color')} attr="tickcolor" />
<Numeric label={_('Legth')} attr="ticklen" />
<Numeric label={_('Length')} attr="ticklen" />
<Numeric label={_('Width')} attr="tickwidth" />
</PlotlySection>
</SliderAccordion>
Expand Down
77 changes: 53 additions & 24 deletions src/default_panels/StyleUpdateMenusPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,71 @@ import {
ColorPicker,
FontSelector,
Numeric,
Radio,
PlotlySection,
UpdateMenuAccordion,
UpdateMenuButtons,
VisibilitySelect,
Radio,
} from '../components';

const StyleUpdateMenusPanel = (props, {localize: _}) => (
<UpdateMenuAccordion>
<Radio
<VisibilitySelect
attr="visible"
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
/>
<PlotlySection name={_('Button Labels')}>
<UpdateMenuButtons attr="buttons" />
</PlotlySection>
<PlotlySection name={_('Background')}>
<ColorPicker label={_('Color')} attr="bgcolor" />
</PlotlySection>
<PlotlySection name={_('Font')}>
<FontSelector label={_('Typeface')} attr="font.family" />
<Numeric label={_('Size')} attr="font.size" />
<ColorPicker label={_('Color')} attr="font.color" />
</PlotlySection>
<PlotlySection name={_('Border')}>
<Numeric label={_('Width')} attr="borderwidth" />
<ColorPicker label={_('Color')} attr="bordercolor" />
</PlotlySection>
<PlotlySection name={_('Padding')}>
<Numeric label={_('Top')} attr="pad.t" units="px" />
<Numeric label={_('Bottom')} attr="pad.b" units="px" />
<Numeric label={_('Left')} attr="pad.l" units="px" />
<Numeric label={_('Right')} attr="pad.r" units="px" />
</PlotlySection>
showOn={true}
>
<PlotlySection name={_('Button Labels')}>
<UpdateMenuButtons attr="buttons" />
</PlotlySection>
<PlotlySection name={_('Background')}>
<ColorPicker label={_('Color')} attr="bgcolor" />
</PlotlySection>
<PlotlySection name={_('Font')}>
<FontSelector label={_('Typeface')} attr="font.family" />
<Numeric label={_('Size')} attr="font.size" />
<ColorPicker label={_('Color')} attr="font.color" />
</PlotlySection>
<PlotlySection name={_('Border')}>
<Numeric label={_('Width')} attr="borderwidth" />
<ColorPicker label={_('Color')} attr="bordercolor" />
</PlotlySection>

<PlotlySection name={_('Horizontal Positioning')} attr={'x'}>
<Numeric label={_('Position')} attr={'x'} showSlider step={0.02} />
<Radio
label={_('Anchor')}
attr={'xanchor'}
options={[
{label: _('Left'), value: 'left'},
{label: _('Center'), value: 'center'},
{label: _('Right'), value: 'right'},
]}
/>
</PlotlySection>
<PlotlySection name={_('Vertical Positioning')} attr={'y'}>
<Numeric label={_('Position')} attr={'y'} showSlider step={0.02} />
<Radio
label={_('Anchor')}
attr={'yanchor'}
options={[
{label: _('Top'), value: 'top'},
{label: _('Middle'), value: 'middle'},
{label: _('Bottom'), value: 'bottom'},
]}
/>
</PlotlySection>

<PlotlySection name={_('Padding')}>
<Numeric label={_('Top')} attr="pad.t" units="px" />
<Numeric label={_('Bottom')} attr="pad.b" units="px" />
<Numeric label={_('Left')} attr="pad.l" units="px" />
<Numeric label={_('Right')} attr="pad.r" units="px" />
</PlotlySection>
</VisibilitySelect>
</UpdateMenuAccordion>
);

Expand Down