Info.svelte
2.45 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<script>
import SideBar from "./SideBar.svelte"
export let festa;
export let sidebar_show = false;
var side = "right";
var weatherData, weathers;
const WEATHERIMG = {
"맑음" : "./public/sunny.png",
"비" : "./public/rain.png",
"비/눈" : "./public/rainsnow.png",
"눈" : "./public/snow.png"
}
function hide() {
if (window.scrollY > 400) {
sidebar_show = false;
}
}
$: if(festa.weathers) weatherData = JSON.parse(festa.weathers);
$: if(festa.weathers) weathers = Array.from(Object.keys(weatherData)).map((v) => {
return { "date" : v.slice(4), "temp" : weatherData[v].temp, "weather" : weatherData[v].weather };
});
</script>
<style>
.info {
display: flex;
flex-direction: column;
align-items: center;
}
.title {
font-size: 18pt;
font-weight: bold;
}
.content {
padding: 0.5rem 0.5rem 0.5rem;
text-align: left;
}
.festaimg {
max-width: 560px;
}
.locpin, .telpin, .calpin {
width: 20px;
height: 20px;
}
.weather {
/* border: 1px solid #999999; */
border-collapse: collapse;
}
.weather td {
padding: 0.3rem;
border: 1px solid #cccccc;
}
.weatherimg {
width : 100px;
}
</style>
<svelte:window on:scroll={hide}></svelte:window>
<SideBar bind:show={sidebar_show} {side}>
<div class="info">
<div class="title">{festa.title}</div>
<img class="festaimg" alt="festaimg" src={festa.firstimage}><br>
{#if weathers}
<table class="weather"><tr>
{#each weathers as weather}
<td class="weathercell">
<img class="weatherimg" alt="weather" src={WEATHERIMG[weather.weather]}><br>
{weather.date.slice(0, 2) + '/' + weather.date.slice(2, 4)}<br>
{weather.temp}℃<br>
</td>
{/each}
</tr></table>
{/if}
<div class="content">
<img class="locpin" alt="pin" src="/public/map-pin.png"> 개최지 : {festa.addr}<br>
<img class="telpin" alt="pin" src="/public/tel-pin.jpeg"> 전화번호 : {festa.tel}<br>
<img class="calpin" alt="pin" src="/public/cal-pin.png"> 행사일 : {festa.eventstartdate} - {festa.eventenddate}<br>
</div>
</div>
</SideBar>