diff options
Diffstat (limited to 'frontend/app/views/tile/components/tile.form.js')
| -rw-r--r-- | frontend/app/views/tile/components/tile.form.js | 108 |
1 files changed, 104 insertions, 4 deletions
diff --git a/frontend/app/views/tile/components/tile.form.js b/frontend/app/views/tile/components/tile.form.js index 8a6a08e..6a65194 100644 --- a/frontend/app/views/tile/components/tile.form.js +++ b/frontend/app/views/tile/components/tile.form.js @@ -17,7 +17,7 @@ import * as pageActions from 'app/views/page/page.actions' import * as tileActions from 'app/views/tile/tile.actions' const SELECT_TYPES = [ - "image", "text", "video", "link", "script", + "image", "text", "video", "link", "gradient", "script", ].map(s => ({ name: s, label: s })) const ALIGNMENTS = [ @@ -36,6 +36,7 @@ const REQUIRED_KEYS = { video: ['url'], text: ['content'], link: [], + gradient: [], script: [], } @@ -146,6 +147,24 @@ const newText = (data) => ({ ...data, }) +const newGradient = (data) => ({ + settings: { + ...newPosition({ width: 100, height: 100 }), + from_color: '#ffffff', + from_opacity: 1.0, + to_color: '#000000', + to_opacity: 1.0, + angle: 0, + stop: 50, + units: '%', + external_link_url: "", + cursor: 'hand_up', + }, + type: 'gradient', + target_page_id: 0, + ...data, +}) + const newLink = (data) => ({ settings: { ...newPosition({ width: 100, height: 100, }), @@ -185,6 +204,7 @@ const TYPE_CONSTRUCTORS = { video: newVideo, text: newText, link: newLink, + gradient: newGradient, script: newScript, } @@ -232,7 +252,7 @@ class TileForm extends Component { ] this.setState({ pageList, popupList }) if (isNew) { - const newTile = newImage({ + const newTile = newGradient({ id: "new", graph_id: graph.show.res.id, page_id: page.show.res.id, @@ -462,6 +482,8 @@ class TileForm extends Component { ? this.renderTextForm() : temporaryTile.type === 'link' ? this.renderLinkForm() + : temporaryTile.type === 'gradient' + ? this.renderGradientForm() : temporaryTile.type === 'script' ? this.renderScriptForm() : ""} @@ -741,7 +763,7 @@ class TileForm extends Component { name="width" data={temporaryTile.settings} min={0} - max={1200} + max={2400} error={errorFields.has('width')} onChange={this.handleSettingsChange} autoComplete="off" @@ -751,7 +773,7 @@ class TileForm extends Component { name="height" data={temporaryTile.settings} min={0} - max={1200} + max={2400} error={errorFields.has('height')} onChange={this.handleSettingsChange} autoComplete="off" @@ -761,6 +783,84 @@ class TileForm extends Component { ) } + renderGradientForm() { + const { temporaryTile } = this.props + return ( + <div> + <ColorInput + title='From' + name='from_color' + data={temporaryTile.settings} + onChange={this.handleSettingsChange} + autoComplete="off" + /> + <Slider + title='Opacity' + name='from_opacity' + value={temporaryTile.settings.from_opacity} + onChange={this.handleSettingsSelect} + min={0.0} + max={1.0} + step={0.01} + /> + <ColorInput + title='To' + name='to_color' + data={temporaryTile.settings} + onChange={this.handleSettingsChange} + autoComplete="off" + /> + <Slider + title='Opacity' + name='to_opacity' + value={temporaryTile.settings.to_opacity} + onChange={this.handleSettingsSelect} + min={0.0} + max={1.0} + step={0.01} + /> + <Slider + title='Angle' + name='angle' + value={temporaryTile.settings.angle} + onChange={this.handleSettingsSelect} + min={0.0} + max={360.0} + step={0.1} + /> + <Slider + title='Stop' + name='stop' + value={temporaryTile.settings.stop} + onChange={this.handleSettingsSelect} + min={0.0} + max={100.0} + step={0.1} + /> + <div className='row pair'> + <NumberInput + title="Width" + name="width" + data={temporaryTile.settings} + min={0} + max={2400} + onChange={this.handleSettingsChange} + autoComplete="off" + /> + <NumberInput + title="Height" + name="height" + data={temporaryTile.settings} + min={0} + max={2400} + onChange={this.handleSettingsChange} + autoComplete="off" + /> + </div> + </div> + ) + } + renderScriptForm() { const { temporaryTile } = this.props const { errorFields } = this.state |
