Skip to content

Commit

Permalink
remove colorPicker Widget
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshgulia1 committed Nov 23, 2020
1 parent dc521e5 commit 61c0a12
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 127 deletions.
1 change: 0 additions & 1 deletion src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ export AccordionBlockEdit from './manage/Blocks/Accordion/Edit';
export AccordionBlockView from './manage/Blocks/Accordion/View';
export AccordionBlockSchema from './manage/Blocks/Accordion/Schema';
export PanelWidget from './manage/Widgets/PanelWidget';
export ColorPickerWidget from './manage/Widgets/ColorPickerWidget';

export { options } from './manage/Blocks/Accordion/panels';
10 changes: 2 additions & 8 deletions src/components/manage/Blocks/Accordion/AccordionEdit.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import React from 'react';
import { Accordion, Input } from 'semantic-ui-react';

import {
applyBgColor,
applyTitleSize,
} from '@eeacms/volto-accordion-block/components/manage/Styles';
import { applyTitleSize } from '@eeacms/volto-accordion-block/components/manage/Styles';
import cx from 'classnames';
import { Icon } from '@plone/volto/components';
import rightSVG from '@plone/volto/icons/right-key.svg';
Expand Down Expand Up @@ -61,10 +58,7 @@ export default ({
</Accordion.Title>
<div>
<Accordion.Content active={activeIndex === 0}>
<div
style={{ margin: '1em' }}
{...applyBgColor(data?.data?.blocks?.settings || {})}
>
<div style={{ margin: '1em' }}>
<AnimateHeight
animateOpacity
duration={500}
Expand Down
6 changes: 2 additions & 4 deletions src/components/manage/Blocks/Accordion/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Panels from './Panels.jsx';
import { empty, getColumns } from './util';
import { options } from './panels';
import { blocks } from '~/config';
import { makeStyleSchema } from '@eeacms/volto-accordion-block/components/manage/Styles';
import { StyleSchema } from '@eeacms/volto-accordion-block/components/manage/Styles/schema';
import './editor.less';
import upSVG from '@plone/volto/icons/up.svg';
import tuneSVG from '@plone/volto/icons/tune.svg';
Expand Down Expand Up @@ -78,8 +78,6 @@ const Edit = (props) => {
},
});
};
const { available_colors } = blocks.blocksConfig['accordion'];
const AccodionStyleSchema = makeStyleSchema({ available_colors });

return (
<section className="section-block">
Expand Down Expand Up @@ -201,7 +199,7 @@ const Edit = (props) => {
</Button>
</Segment>
<InlineForm
schema={AccodionStyleSchema}
schema={StyleSchema()}
title="Panels"
onChangeField={onChangeColumnSettings}
formData={data?.data?.blocks?.settings || {}}
Expand Down
7 changes: 2 additions & 5 deletions src/components/manage/Blocks/Accordion/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import React from 'react';
import { RenderBlocks } from '@eeacms/volto-blocks-form/components';
import { getColumns, GroupblockHasValue } from './util';
import { Accordion } from 'semantic-ui-react';
import {
applyBgColor,
applyTitleSize,
} from '@eeacms/volto-accordion-block/components/manage/Styles';
import { applyTitleSize } from '@eeacms/volto-accordion-block/components/manage/Styles';

import cx from 'classnames';
import { Icon } from '@plone/volto/components';
Expand Down Expand Up @@ -57,7 +54,7 @@ const View = (props) => {
</Accordion.Title>
<div>
<Accordion.Content active={activeIndex === index}>
<div {...applyBgColor(data?.blocks?.settings || {})}>
<div>
<AnimateHeight
animateOpacity
duration={500}
Expand Down
16 changes: 0 additions & 16 deletions src/components/manage/Styles/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
import { StyleSchema } from './schema';

export function makeStyleSchema({ available_colors }) {
const schema = StyleSchema();
schema.properties.backgroundColor.available_colors = available_colors;
return schema;
}

export function applyBgColor(props) {
return {
style: {
backgroundColor: props.backgroundColor,
},
};
}

export function applyTitleSize(props) {
return {
style: {
Expand Down
7 changes: 1 addition & 6 deletions src/components/manage/Styles/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ export const StyleSchema = () => ({
{
id: 'default',
title: 'Style',
fields: ['backgroundColor', 'title_size', 'arrow_select'],
fields: ['title_size', 'arrow_select'],
},
],
properties: {
backgroundColor: {
title: 'Background color',
type: 'color',
widget: 'color_picker',
},
title_size: {
title: 'Title size',
description: 'Size of accordion Title in a Panel',
Expand Down
63 changes: 0 additions & 63 deletions src/components/manage/Widgets/ColorPickerWidget.jsx

This file was deleted.

25 changes: 1 addition & 24 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import {
AccordionBlockView,
AccordionBlockSchema,
} from './components';
import {
PanelWidget,
ColorPickerWidget,
} from '@eeacms/volto-accordion-block/components';
import { PanelWidget } from '@eeacms/volto-accordion-block/components';
import { options } from '@eeacms/volto-accordion-block/components';

const applyConfig = (config) => {
Expand Down Expand Up @@ -53,28 +50,8 @@ const applyConfig = (config) => {
addPermission: [],
view: [],
},
available_colors: [
// '#B80000',
// '#DB3E00',
// '#FCCB00',
// '#008B02',
// '#006B76',
// '#1273DE',
// '#004DCF',
// '#5300EB',
'#EFEFEF',
'#EB9694',
'#FAD0C3',
'#FEF3BD',
'#C1E1C5',
'#BEDADC',
'#C4DEF6',
'#BED3F3',
'#D4C4FB',
],
};
config.widgets.type.panels = PanelWidget;
config.widgets.widget.color_picker = ColorPickerWidget;
return config;
};

Expand Down

0 comments on commit 61c0a12

Please sign in to comment.