use custom styles for the form timeline, move away from charts.css

pull/1/head
ansuz 3 years ago
parent 25a3359671
commit 4810d6b5ba

@ -1,4 +1,58 @@
.charts_main() { .charts_main() {
// basic functional things
table.cp-charts.column {
box-sizing: border-box;
display: flex;
height: 100%;
overflow-x: auto;
tbody {
height: 100%;
display: flex;
align-items: stretch;
min-width: 100%;
tr {
position: relative;
display: flex;
justify-content: flex-start;
flex-direction: row;
flex-shrink: 1;
flex-grow: 1;
justify-content: flex-start;
align-items: flex-end;
td {
display: flex;
height: calc(100% * var(--size));
align-items: flex-start;
flex-grow: 1;
}
}
}
}
// styles
table.cp-charts.column {
//border: 1px solid white;
tbody {
tr {
max-width: 30px;
td {
min-width: 3px;
border: 1px solid @cryptpad_color_brand;
background: @cryptpad_color_brand;
margin: 1px;
}
}
}
}
&.bar { &.bar {
th { th {
//width: 200px !important; //width: 200px !important;

@ -69,6 +69,12 @@
justify-content: center; justify-content: center;
min-width: 300px; min-width: 300px;
div.timeline-container {
width: 100%;
height: 200px;
}
/*
table.cp-chart-table { table.cp-chart-table {
--color: @colortheme_apps[pad]; --color: @colortheme_apps[pad];
@ -107,6 +113,7 @@
color: transparent; color: transparent;
} }
} }
*/
.cp-form-input-block { .cp-form-input-block {
display: flex; display: flex;
@ -838,8 +845,6 @@
} }
} }
.charts-css {
.charts_main(); .charts_main();
}
} }

@ -38,7 +38,7 @@ define([
'css!/bower_components/codemirror/addon/dialog/dialog.css', 'css!/bower_components/codemirror/addon/dialog/dialog.css',
'css!/bower_components/codemirror/addon/fold/foldgutter.css', 'css!/bower_components/codemirror/addon/fold/foldgutter.css',
'css!/lib/datepicker/flatpickr.min.css', 'css!/lib/datepicker/flatpickr.min.css',
'css!/lib/chart/charts.min.css', //'css!/lib/chart/charts.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/form/app-form.less', 'less!/form/app-form.less',
], function ( ], function (
@ -1910,27 +1910,29 @@ define([
var max_day = arrayMax(times); var max_day = arrayMax(times);
var days = getDayArray(new Date(min_day), new Date(max_day)); var days = getDayArray(new Date(min_day), new Date(max_day));
return Charts.table(h('tbody', days.map(function (time) { if (days.length < 2) { return; }
return h('div.timeline-container', {
//style: 'width: 100%; height: 200px;',
}, h('table.cp-charts.column.cp-chart-timeline.cp-chart-table',
h('tbody', days.map(function (time) {
var count = tally[time] || 0; var count = tally[time] || 0;
var percent = count / max_count; var percent = count / max_count;
var date = new Date(time).toLocaleDateString(); var date = new Date(time).toLocaleDateString();
var bar = h('td.cp-bar', { var bar = h('td', {
style: '--size: ' + Number(percent).toFixed(2), style: '--size: ' + Number(percent).toFixed(2),
"data-tippy-placement": "top", //"data-tippy-placement": "top",
title: Messages._getKey('form_timelineLabel', [date, count]) title: Messages._getKey('form_timelineLabel', [date, count])
}); });
var dateEl = h('th', { scope: "row" }, date); //var dateEl = h('th', { scope: "row" }, date);
return h('tr', bar, dateEl ); return h('tr', bar/* dateEl*/ );
})), [ }))
"charts-css", )
"cp-chart-table", );
"column",
//"data-spacing-2",
//"show-labels",
//"labels-align-center"
]);
}; };
var renderResults = APP.renderResults = function (content, answers, showUser) { var renderResults = APP.renderResults = function (content, answers, showUser) {

Loading…
Cancel
Save