-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6266 from deutschebank/db-contrib/waltz-6263-asse…
…ssment-search Db contrib/waltz 6263 assessment search
- Loading branch information
Showing
6 changed files
with
131 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<script> | ||
import _ from "lodash"; | ||
import {scaleLinear} from "d3-scale"; | ||
import {color} from "d3-color"; | ||
import ColorPicker from "../../system/svelte/ratings-schemes/ColorPicker.svelte"; | ||
import {rgbToHex} from "../../common/colors"; | ||
let rows = []; | ||
let howMany = 5; | ||
let colors = null; | ||
let startColor = "#5bb65d"; | ||
let endColor = "#dae714"; | ||
function swap() { | ||
const temp = startColor; | ||
startColor = endColor; | ||
endColor = temp; | ||
} | ||
$: colors = scaleLinear() | ||
.domain([0, howMany]) | ||
.range([startColor, endColor]); | ||
$: rows = _.range(0, howMany).map(d => { | ||
const colorRgb = color(colors(d)); | ||
return { | ||
colorRgb, | ||
colorHex: rgbToHex(colorRgb.r, colorRgb.g, colorRgb.b) | ||
}; | ||
}); | ||
</script> | ||
|
||
<div class="row"> | ||
<div class="col-sm-6"> | ||
<label>Rows ({howMany}): | ||
<input type="range" | ||
min="0" | ||
max="30" | ||
bind:value={howMany}> | ||
</label> | ||
<br> | ||
<label>Start Color | ||
<ColorPicker startColor={'#5bb65d'} | ||
on:select={evt => startColor = evt.detail}/> | ||
</label> | ||
<br> | ||
<label>End Color | ||
<ColorPicker startColor={'#dae714'} | ||
on:select={evt => endColor = evt.detail}/> | ||
</label> | ||
</div> | ||
|
||
<div class="col-sm-6"> | ||
<table class="table table-condensed table-striped"> | ||
{#each rows as row} | ||
<tr> | ||
<td> | ||
<div class="box" | ||
style={`background-color: ${row.colorRgb}`}> | ||
</div> | ||
</td> | ||
<td><span>{row.colorHex}</span></td> | ||
</tr> | ||
{/each} | ||
</table> | ||
|
||
<button class="btn" | ||
on:click={swap}> | ||
Swap Direction | ||
</button> | ||
</div> | ||
</div> | ||
|
||
|
||
<style> | ||
.box { | ||
width: 1em; | ||
height: 1em; | ||
} | ||
</style> |
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
25 changes: 24 additions & 1 deletion
25
waltz-ng/client/system/svelte/ratings-schemes/ColorPicker.svelte
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