Skip to content

Commit b4024b4

Browse files
yinminouetakuya
authored andcommitted
Access セクションを追加する (vuejs-jp#107)
* Access セクションを追加する * テストを追加する * HTMLのコーディングとGoogleMapsの調整をする * エラーを吐いてたので、Union Typesにする エラー内容: Type 'string | undefined' is not assignable to type 'string'. * smのスタイルを調整する * mdのスタイルを調整する * yarn add vue2-google-maps * vue2-google-mapsを使用できるようにする * vue2-google-mapsを使って書き直す * Fix `[Vue warn]: Unknown custom element: <GmapMap>` * 昨年に合わせて、infoWindowを表示する * リンクであることがわかりやすいように、下線をつける * HTMLの文章構造を正す * Revert "Fix `[Vue warn]: Unknown custom element: <GmapMap>`" This reverts commit 53ab58b. * Revert "vue2-google-mapsを使って書き直す" This reverts commit dfabb1c. * Revert "vue2-google-mapsを使用できるようにする" This reverts commit 2bea327. * Revert "yarn add vue2-google-maps" This reverts commit a138d4a. * エラーを解決するために、`type="application/javascript"`を指定する エラーメッセージ: Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
1 parent e1e67ce commit b4024b4

File tree

5 files changed

+140
-1
lines changed

5 files changed

+140
-1
lines changed

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CTF_SPACE_ID=PLEASE_SET_CTF_SPACE_ID
22
CTF_CDA_ACCESS_TOKEN=PLEASE_SET_CTF_CDA_ACCESS_TOKEN
33
GA_TRACKING_ID=UA-XXXXXXX-X
4+
GOOGLE_MAPS_API_KEY=PLEASE_SET_ME

nuxt.config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ const config: NuxtConfiguration = {
112112
env: {
113113
CTF_SPACE_ID: process.env.CTF_SPACE_ID || 'PLEASE_SET_CTF_SPACE_ID',
114114
CTF_CDA_ACCESS_TOKEN:
115-
process.env.CTF_CDA_ACCESS_TOKEN || 'PLEASE_SET_CTF_CDA_ACCESS_TOKEN'
115+
process.env.CTF_CDA_ACCESS_TOKEN || 'PLEASE_SET_CTF_CDA_ACCESS_TOKEN',
116+
GOOGLE_MAPS_API_KEY: process.env.GOOGLE_MAPS_API_KEY || 'PLEASE_SET_ME'
116117
},
117118
build: {
118119
extend(config, ctx) {

src/components/TheAccessSection.vue

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<template>
2+
<BaseSection class="the-access-section">
3+
<template slot="heading">
4+
ACCESS
5+
</template>
6+
7+
<div id="map" />
8+
9+
<!-- eslint-disable vue/html-indent -->
10+
<script type="application/javascript">
11+
function initMap() {
12+
const latlng = new google.maps.LatLng(35.6230000, 139.717600)
13+
const map = new google.maps.Map(document.getElementById('map'), {
14+
center: latlng,
15+
zoom: 16
16+
})
17+
const infowindow = new google.maps.InfoWindow({
18+
content: 'TOC五反田メッセ',
19+
position: latlng
20+
})
21+
infowindow.open(map)
22+
}
23+
</script>
24+
<!-- eslint-enable vue/html-indent -->
25+
26+
<script
27+
type="application/javascript"
28+
:src="
29+
`https://maps.googleapis.com/maps/api/js?key=${googleMapsApiKey}&callback=initMap`
30+
"
31+
async
32+
defer
33+
/>
34+
35+
<h3 class="title">
36+
会場:TOC五反田メッセ
37+
</h3>
38+
39+
<div class="description">
40+
<p>
41+
<a href="http://messe.toc.co.jp/" target="_blank" rel="noopener">
42+
http://messe.toc.co.jp/
43+
</a>
44+
<br />
45+
東京都品川区西五反田6-6-19
46+
</p>
47+
48+
<p>
49+
<span class="line">JR山手線、都営地下鉄浅草線でお越しの方</span><br />
50+
五反田駅 西口より徒歩10
51+
</p>
52+
53+
<p>
54+
<span class="line">東急池上線でお越しの方</span><br />
55+
大崎広小路駅より徒歩9
56+
</p>
57+
58+
<p>
59+
<span class="line">東急目黒線でお越しの方</span><br />
60+
不動前駅より徒歩6
61+
</p>
62+
</div>
63+
</BaseSection>
64+
</template>
65+
66+
<script lang="ts">
67+
import { Component, Vue } from 'nuxt-property-decorator'
68+
import BaseSection from '~/components/BaseSection.vue'
69+
70+
@Component({
71+
components: {
72+
BaseSection
73+
}
74+
})
75+
export default class TheAccessSection extends Vue {
76+
private get googleMapsApiKey(): string | undefined {
77+
return process.env.GOOGLE_MAPS_API_KEY
78+
}
79+
}
80+
</script>
81+
82+
<style lang="scss" scoped>
83+
#map {
84+
margin-bottom: 10px;
85+
height: 439px;
86+
87+
@media screen and (min-width: $layout-breakpoint--is-small-up) {
88+
height: 516px;
89+
}
90+
}
91+
92+
.title {
93+
margin-bottom: 10px;
94+
font-size: 5vw;
95+
font-weight: bold;
96+
line-height: 1.28;
97+
98+
@media screen and (min-width: $layout-breakpoint--is-small-up) {
99+
margin-bottom: 3px;
100+
font-size: 30px;
101+
}
102+
}
103+
104+
.description {
105+
p {
106+
font-size: 3.5vw;
107+
108+
@media screen and (min-width: $layout-breakpoint--is-small-up) {
109+
font-size: 16px;
110+
}
111+
}
112+
113+
a {
114+
color: $primary-text-color;
115+
}
116+
117+
p + p {
118+
margin-top: 40px;
119+
}
120+
}
121+
122+
.line {
123+
font-weight: bold;
124+
}
125+
</style>

src/pages/index.vue

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TheSpeakerListSection />
55
<TheTicketSection />
66
<TheSponsorListSection :sponsor-list="sponsors || []" />
7+
<TheAccessSection />
78
<TheStoreSection />
89
<TheStaffListSection />
910
</div>
@@ -13,6 +14,7 @@
1314
import { Component, Vue } from 'nuxt-property-decorator'
1415
import { Entry } from 'contentful/index'
1516
import { getSponsors } from '~/plugins/contentful.ts'
17+
import TheAccessSection from '~/components/TheAccessSection.vue'
1618
import TheHeadSection from '~/components/TheHeadSection.vue'
1719
import TheSpeakerListSection from '~/components/TheSpeakerListSection.vue'
1820
import TheTicketSection from '~/components/TheTicketSection.vue'
@@ -22,6 +24,7 @@ import TheStoreSection from '~/components/TheStoreSection.vue'
2224
2325
@Component({
2426
components: {
27+
TheAccessSection,
2528
TheHeadSection,
2629
TheSpeakerListSection,
2730
TheTicketSection,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { mount } from '@vue/test-utils'
2+
import TheAccessSection from '~/components/TheAccessSection.vue'
3+
4+
describe('TheAccessSection', () => {
5+
test('レンダリングできる', () => {
6+
const wrapper = mount(TheAccessSection)
7+
expect(wrapper.find('.the-access-section').isVisible()).toBeTruthy()
8+
})
9+
})

0 commit comments

Comments
 (0)