summaryrefslogtreecommitdiff
path: root/src/lib/component/CV.svelte
blob: b24d2cff38603e92d1b08a4b2091f45d5bdea5bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<script lang="ts">
  //// import
  import { onMount } from "svelte";

  //// var
  let cv = "";

  //// function
  async function showContent() {
    let cvContent = "";

    try {
      const response = await fetch("/api/cv.json", {
        headers: {
          "Accept": "application/json",
          "Content-Type": "application/json"
        },
        method: "POST"
      });

      const { content } = await response.json();
      cvContent = content;
    } catch(error) {
      console.error(error);
    }

    return cvContent;
  }

  onMount(async() => {
    cv = await showContent();
  });
</script>

<style lang="scss">
  :root {
    --cv-padding: calc(var(--padding) * 2);
  }

  h2 {
    margin: 0 0 var(--cv-padding); padding: var(--padding) var(--cv-padding);

    background-color: var(--color-border);
    color: var(--uchu-yin-7);
    font-size: 1rem;
    line-height: inherit;
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .content {
    font-family: monospace;
    line-height: 1.55;
    overflow-x: hidden;
    padding-left: var(--cv-padding);
    padding-right: var(--cv-padding);
    position: relative;
    text-overflow: ellipsis;
    white-space: pre-line;

    &.loading {
      padding-bottom: var(--cv-padding);
    }
  }
</style>

<h2>
  <a href="https://cv.webb.page" target="_blank">cv.webb.page</a>
</h2>

{#if cv === ""}
  <div class="content loading">loading&hellip;</div>
{:else}
  <div class="content">
    {cv}
  </div>
{/if}