Fix Icon behaviour with empty clickhandler

Signed-off-by: Sebastian Martinez <sebastinez@me.com>
Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Sebastian Martinez
2022-02-05 21:05:22 +01:00
committed by Alexis Sellier
parent 9a91e53619
commit 02a0ed4664
6 changed files with 31 additions and 29 deletions
+12 -12
View File
@@ -30,7 +30,7 @@
"multihashes": "^4.0.2",
"pure-svg-code": "^1.0.6",
"sanitize-html": "^2.6.1",
"svelte": "^3.44.3",
"svelte": "^3.46.3",
"svelte-preprocess": "^4.7.2",
"svelte-routing": "^1.6.0"
},
@@ -47,7 +47,7 @@
"eslint": "^7.28.0",
"eslint-plugin-svelte3": "^3.2.0",
"radicle-svelte-unit-test": "^1.0.0",
"svelte-check": "^1.5.2",
"svelte-check": "^2.4.1",
"typescript": "^4.2.4",
"vite": "^2.7.13",
"vite-plugin-istanbul": "^2.4.0",
@@ -10525,16 +10525,16 @@
}
},
"node_modules/svelte-check": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-1.6.0.tgz",
"integrity": "sha512-nQTlbFJWhwoeLY5rkhgbjzGQSwk5F1pRdEXait0EFaQSrE/iJF+PIjrQlk0BjL/ogk9HaR9ZI0DQSYrl7jl3IQ==",
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-2.4.1.tgz",
"integrity": "sha512-xhf3ShP5rnRwBokrgTBJ/0cO9QIc1DAVu1NWNRTfCDsDBNjGmkS3HgitgUadRuoMKj1+irZR/yHJ+Uqobnkbrw==",
"dev": true,
"dependencies": {
"chalk": "^4.0.0",
"chokidar": "^3.4.1",
"glob": "^7.1.6",
"fast-glob": "^3.2.7",
"import-fresh": "^3.2.1",
"minimist": "^1.2.5",
"picocolors": "^1.0.0",
"sade": "^1.7.4",
"source-map": "^0.7.3",
"svelte-preprocess": "^4.0.0",
@@ -19426,16 +19426,16 @@
"integrity": "sha512-mTOXvv74CVQqJHqoIZDprVfRKVVmYNadXP0VKnOEA54223kLGCr1nMrifS4Zx29qMt/xRB38Eq1D7dDH/fM8fQ=="
},
"svelte-check": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-1.6.0.tgz",
"integrity": "sha512-nQTlbFJWhwoeLY5rkhgbjzGQSwk5F1pRdEXait0EFaQSrE/iJF+PIjrQlk0BjL/ogk9HaR9ZI0DQSYrl7jl3IQ==",
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-2.4.1.tgz",
"integrity": "sha512-xhf3ShP5rnRwBokrgTBJ/0cO9QIc1DAVu1NWNRTfCDsDBNjGmkS3HgitgUadRuoMKj1+irZR/yHJ+Uqobnkbrw==",
"dev": true,
"requires": {
"chalk": "^4.0.0",
"chokidar": "^3.4.1",
"glob": "^7.1.6",
"fast-glob": "^3.2.7",
"import-fresh": "^3.2.1",
"minimist": "^1.2.5",
"picocolors": "^1.0.0",
"sade": "^1.7.4",
"source-map": "^0.7.3",
"svelte-preprocess": "^4.0.0",
+2 -2
View File
@@ -24,7 +24,7 @@
"eslint": "^7.28.0",
"eslint-plugin-svelte3": "^3.2.0",
"radicle-svelte-unit-test": "^1.0.0",
"svelte-check": "^1.5.2",
"svelte-check": "^2.4.1",
"typescript": "^4.2.4",
"vite": "^2.7.13",
"vite-plugin-istanbul": "^2.4.0",
@@ -54,7 +54,7 @@
"multihashes": "^4.0.2",
"pure-svg-code": "^1.0.6",
"sanitize-html": "^2.6.1",
"svelte": "^3.44.3",
"svelte": "^3.46.3",
"svelte-preprocess": "^4.7.2",
"svelte-routing": "^1.6.0"
}
+9 -9
View File
@@ -4,7 +4,6 @@
export let height: number | null = null;
export let inline = false;
export let fill = false;
export let clickHandler: (() => void) | undefined = undefined;
const icons = [
{
@@ -52,7 +51,7 @@
svg.fill {
fill: currentColor;
}
svg.inline {
span.inline, svg.inline {
height: 1.6rem;
}
svg.clickable {
@@ -61,11 +60,12 @@
</style>
{#if svg}
<svg role="img" class={$$props.class} class:inline class:fill
width={width || "1rem"}
height={height || "1rem"}
viewBox="{svg.offset?.x || 0} {svg.offset?.y || 0} {svg.size} {svg.size}"
on:click|stopPropagation={clickHandler}>
{@html svg.data}
</svg>
<span on:click class:inline style:height={`${height}px`} style:width={`${width}px`}>
<svg role="img" class={$$props.class} class:inline class:fill
width={width || "1rem"}
height={height || "1rem"}
viewBox="{svg.offset?.x || 0} {svg.offset?.y || 0} {svg.size} {svg.size}">
{@html svg.data}
</svg>
</span>
{/if}
+1 -1
View File
@@ -68,6 +68,6 @@
<div class="right">
<span class="bold author">{commit.committer.name}</span>
<span class="desktop-inline time">{formatCommitTime(commit.committerTime)}</span>
<Icon name="browse" clickHandler={() => browseCommit(commit.sha1)} width={17} inline fill />
<Icon name="browse" width={17} inline fill on:click={() => browseCommit(commit.sha1)} />
</div>
</div>
@@ -73,7 +73,8 @@
<p class="bold">{path}</p>
<span class="diff-type created">created</span>
</div>
<Icon class="clickable" clickHandler={() => dispatch("browse", path)} name="browse" width={20} inline fill />
<Icon class="clickable" name="browse" width={20} inline fill
on:click={() => dispatch("browse", path)} />
</header>
{/each}
{#each diff.deleted as path (path)}
@@ -82,7 +83,8 @@
<p class="bold">{path}</p>
<span class="diff-type deleted">deleted</span>
</div>
<Icon class="clickable" clickHandler={() => dispatch("browse", path)} name="browse" width={20} inline fill />
<Icon class="clickable" name="browse" width={20} inline fill
on:click={() => dispatch("browse", path)} />
</header>
{/each}
</div>
@@ -3,7 +3,7 @@
import Icon from "@app/Icon.svelte";
import { lineNumberL, lineNumberR, lineSign } from "@app/diff";
import type { FileDiff } from "@app/diff";
const dispatch = createEventDispatcher();
export let file: FileDiff;
@@ -109,10 +109,10 @@
<header
on:click={collapse}>
<div class="actions">
<Icon clickHandler={collapse} name="chevron" width={20} inline fill />
<Icon name="chevron" width={20} inline fill />
<p class="bold file-path">{file.path}</p>
</div>
<Icon clickHandler={() => dispatch("browse", file.path)} name="browse" width={20} inline fill />
<Icon name="browse" width={20} inline fill on:click={() => dispatch("browse", file.path)} />
</header>
{#if !collapsed}
<main>