-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor panel components to use CSS modules and improve class …
…naming
- Loading branch information
1 parent
50900c1
commit 242de0c
Showing
12 changed files
with
203 additions
and
145 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,85 @@ | ||
import React, { Component } from 'react' | ||
import _ from 'lodash' | ||
|
||
import Icon from '../Icon' | ||
|
||
import styles from './styles' | ||
import React from 'react' | ||
import PropertyGroup from './PropertyGroup' | ||
import Button from './Button' | ||
import SwitchState from './SwitchState' | ||
import Columns from './Columns' | ||
import Column from './Column' | ||
import ColorInput from './ColorInput' | ||
|
||
export class StylePanel extends Component { | ||
modes = [ | ||
'normal', | ||
'multiply', | ||
'screen', | ||
'overlay', | ||
'darken', | ||
'lighten', | ||
'color-dodge', | ||
'color-burn', | ||
'hard-light', | ||
'soft-light', | ||
'difference', | ||
'exclusion', | ||
'hue', | ||
'saturation', | ||
'color', | ||
'luminosity', | ||
] | ||
import styles from './styles/panel.module.css' | ||
|
||
const modes = [ | ||
'normal', | ||
'multiply', | ||
'screen', | ||
'overlay', | ||
'darken', | ||
'lighten', | ||
'color-dodge', | ||
'color-burn', | ||
'hard-light', | ||
'soft-light', | ||
'difference', | ||
'exclusion', | ||
'hue', | ||
'saturation', | ||
'color', | ||
'luminosity', | ||
] | ||
|
||
export const StylePanel = (props) => { | ||
const object = props?.object | ||
|
||
render() { | ||
let { object } = this.props | ||
return ( | ||
<PropertyGroup> | ||
<Columns label="Fill" showIf={_.has(object, 'fill')}> | ||
<Column> | ||
<ColorInput | ||
value={object.fill} | ||
onChange={this.props.onChange.bind(this, 'fill')} | ||
/> | ||
</Column> | ||
</Columns> | ||
<Columns label="Stroke" showIf={_.has(object, 'stroke')}> | ||
<Column> | ||
<ColorInput | ||
value={object.stroke} | ||
onChange={this.props.onChange.bind(this, 'stroke')} | ||
/> | ||
</Column> | ||
<Column label="width"> | ||
<input | ||
style={{ ...styles.input, ...styles.integerInput, width: 30 }} | ||
onChange={(e) => | ||
this.props.onChange('strokeWidth', e.target.value) | ||
} | ||
value={object.strokeWidth} | ||
/> | ||
</Column> | ||
<Column showIf={_.has(object, 'radius')} label="radius"> | ||
<input | ||
style={{ ...styles.input, ...styles.integerInput, width: 30 }} | ||
onChange={(e) => this.props.onChange('radius', e.target.value)} | ||
value={object.radius} | ||
/> | ||
</Column> | ||
</Columns> | ||
<Columns label="Blending"> | ||
<Column> | ||
<select | ||
style={styles.select} | ||
value={object.blendmode} | ||
onChange={(e) => this.props.onChange('blendmode', e.target.value)} | ||
> | ||
{this.modes.map((mode) => ( | ||
<option key={mode} value={mode}> | ||
{mode} | ||
</option> | ||
))} | ||
</select> | ||
</Column> | ||
</Columns> | ||
</PropertyGroup> | ||
) | ||
} | ||
return ( | ||
<PropertyGroup className="react-designer-style-panel"> | ||
<Columns label="Fill" showIf={object?.hasOwnProperty('fill')}> | ||
<Column> | ||
<ColorInput | ||
value={object.fill} | ||
onChange={props?.onChange?.bind?.(this, 'fill')} | ||
/> | ||
</Column> | ||
</Columns> | ||
<Columns label="Stroke" showIf={object?.hasOwnProperty('stroke')}> | ||
<Column> | ||
<ColorInput | ||
value={object.stroke} | ||
onChange={props?.onChange?.bind?.(this, 'stroke')} | ||
/> | ||
</Column> | ||
<Column label="width"> | ||
<input | ||
className={`${styles.input} ${styles.integerInput}`} | ||
style={{ width: 30 }} | ||
onChange={(e) => | ||
props?.onChange?.('strokeWidth', e.target.value) | ||
} | ||
value={object.strokeWidth} | ||
/> | ||
</Column> | ||
<Column showIf={object?.hasOwnProperty('radius')} label="radius"> | ||
<input | ||
className={`${styles.input} ${styles.integerInput}`} | ||
style={{ width: 30 }} | ||
onChange={(e) => props?.onChange?.('radius', e.target.value)} | ||
value={object.radius} | ||
/> | ||
</Column> | ||
</Columns> | ||
<Columns label="Blending"> | ||
<Column> | ||
<select | ||
className={`${styles.select} react-designer-select`} | ||
value={object.blendmode} | ||
onChange={(e) => props?.onChange?.('blendmode', e.target.value)} | ||
> | ||
{modes.map((mode) => ( | ||
<option key={mode} value={mode}> | ||
{mode} | ||
</option> | ||
))} | ||
</select> | ||
</Column> | ||
</Columns> | ||
</PropertyGroup> | ||
) | ||
|
||
} |
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.