Skip to content

Commit 0d5e2e8

Browse files
committed
add refresh button
1 parent fd241ac commit 0d5e2e8

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 5 additions & 0 deletions
Loading

src/routes/tutorial/[slug]/index.svelte

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import SplitPane from '$lib/components/SplitPane.svelte';
1919
import Editor from './_/Editor.svelte';
2020
import Folder from './_/Folder.svelte';
21+
import refresh from './_/refresh.svg';
2122
import { monaco } from '$lib/client/monaco/monaco.js';
2223
import { Icon } from '@sveltejs/site-kit';
2324
@@ -247,6 +248,16 @@
247248

248249
<section class="preview" slot="b">
249250
<div class="chrome">
251+
<button
252+
on:click={() => {
253+
iframe.src = '/loading.html';
254+
iframe.src = adapter.base + path;
255+
}}
256+
aria-label="reload"
257+
>
258+
<img src={refresh} alt="Reload icon" />
259+
</button>
260+
250261
<input
251262
value={path}
252263
readonly
@@ -397,6 +408,22 @@
397408
background: #f9f9f9;
398409
}
399410
411+
.chrome button {
412+
padding: 0.5rem 1rem;
413+
}
414+
415+
.chrome button img {
416+
height: 100%;
417+
width: auto;
418+
transition: 0.2s ease-out;
419+
transform: none;
420+
}
421+
422+
.chrome button:active img {
423+
transform: rotate(-180deg);
424+
transition: none;
425+
}
426+
400427
.chrome input {
401428
flex: 1;
402429
padding: 0.5rem 1rem 0.4rem 1rem;

0 commit comments

Comments
 (0)