Some visual improvements to projects view

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-04-05 17:04:57 +02:00
parent d0d4e993da
commit 896372cd09
5 changed files with 17 additions and 11 deletions
+12 -6
View File
@@ -4,7 +4,6 @@
export let strokeWidth: number;
export let points: CommitGroup[];
export let strokeColor = "#ff55ff";
export let viewBoxWidth: number;
export let viewBoxHeight: number;
@@ -12,7 +11,7 @@
let path = "";
let areaPath = "";
let heightWithPadding = viewBoxHeight + 10;
let heightWithPadding = viewBoxHeight + 16;
// The latest point on the x axis, starting at 0 until `viewBoxWidth`
let lastWidthPoint = viewBoxWidth;
@@ -65,14 +64,21 @@
// Creates the stroke path with the array of points
path = createPath();
// Concats a path closing for it to be the area under the stroke
areaPath = path.concat(`L${lastWidthPoint},${heightWithPadding}L${viewBoxWidth},${viewBoxHeight+10}Z`);
areaPath = path.concat(`L${lastWidthPoint},${viewBoxHeight}L${viewBoxWidth},${viewBoxHeight}Z`);
});
</script>
<svg viewBox="0 0 {viewBoxWidth} {heightWithPadding}" xmlns="http://www.w3.org/2000/svg">
<use fill="url(#gradient)" />
<svg style="height: 0; width: 0;" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="fillGradient" x1="0" y1="1" x2="0" y2="0">
<stop offset="0%" stop-color="#ff55ff" stop-opacity="0" />
<stop offset="100%" stop-color="#ff55ff" stop-opacity="0.2" />
</linearGradient>
</defs>
</svg>
<g>
<path fill="transparent" stroke={strokeColor} stroke-width={strokeWidth} d={path} />
<path fill="url('#gradient')" stroke="transparent" d={areaPath} />
<path fill="transparent" stroke="url(#gradient)" stroke-width={strokeWidth} stroke-linejoin="round" d={path} />
<path fill="url(#fillGradient)" stroke="transparent" d={areaPath} />
</g>
</svg>
+3 -2
View File
@@ -6,8 +6,9 @@
<svg style="height: 0; width: 0;" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient {id} x1="0" y1="1" x2="0" y2="0">
<stop offset="0%" stop-color={fillColor} stop-opacity="0" />
<stop offset="100%" stop-color={fillColor} stop-opacity="0.4" />
<stop offset="0%" stop-color={fillColor} stop-opacity="0.2" />
<stop offset="50%" stop-color={fillColor} stop-opacity="0.8" />
<stop offset="100%" stop-color={fillColor} stop-opacity="1" />
</linearGradient>
</defs>
</svg>
+1 -1
View File
@@ -50,7 +50,7 @@
margin-top: 1rem;
}
.projects .project {
margin-bottom: 1rem;
margin-bottom: 0.5rem;
}
.actions {
display: flex;
-1
View File
@@ -1,7 +1,6 @@
<script lang="ts">
import CommitTeaser from "./Commit/CommitTeaser.svelte";
import { Project } from "@app/project";
import { ProjectContent } from "@app/project";
import Loading from "@app/Loading.svelte";
import { groupCommitHistory, GroupedCommitsHistory } from "@app/commit";
import Message from "@app/Message.svelte";
+1 -1
View File
@@ -166,7 +166,7 @@
{#await loadCommits() then points}
<div class="desktop activity">
<Diagram {points}
strokeWidth={1.25}
strokeWidth={3}
viewBoxHeight={100}
viewBoxWidth={600}
/>