Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
金城雄夢 committed Jul 3, 2021
0 parents commit 0714f09
Show file tree
Hide file tree
Showing 30 changed files with 16,820 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
}
}
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
parserOptions: {
parser: 'babel-eslint',
},
extends: [
'@nuxtjs',
'plugin:prettier/recommended',
'plugin:nuxt/recommended',
],
plugins: [],
// add your custom rules here
rules: {},
}
90 changes: 90 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# Nuxt generate
dist

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# IDE / Editor
.idea

# Service worker
sw.*

# macOS
.DS_Store

# Vim swap files
*.swp
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": false,
"singleQuote": true
}
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# yumemi_task

## Build Setup

```bash
# install dependencies
$ npm install

# serve with hot reload at localhost:3000
$ npm run dev

# build for production and launch server
$ npm run build
$ npm run start

# generate static project
$ npm run generate
```

For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).
7 changes: 7 additions & 0 deletions assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ASSETS

**This directory is not required, you can delete it if you don't want to use it.**

This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.

More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).
35 changes: 35 additions & 0 deletions components/Logo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
<svg
class="NuxtLogo"
width="245"
height="180"
viewBox="0 0 452 342"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M139 330l-1-2c-2-4-2-8-1-13H29L189 31l67 121 22-16-67-121c-1-2-9-14-22-14-6 0-15 2-22 15L5 303c-1 3-8 16-2 27 4 6 10 12 24 12h136c-14 0-21-6-24-12z"
fill="#00C58E"
/>
<path
d="M447 304L317 70c-2-2-9-15-22-15-6 0-15 3-22 15l-17 28v54l39-67 129 230h-49a23 23 0 0 1-2 14l-1 1c-6 11-21 12-23 12h76c3 0 17-1 24-12 3-5 5-14-2-26z"
fill="#108775"
/>
<path
d="M376 330v-1l1-2c1-4 2-8 1-12l-4-12-102-178-15-27h-1l-15 27-102 178-4 12a24 24 0 0 0 2 15c4 6 10 12 24 12h190c3 0 18-1 25-12zM256 152l93 163H163l93-163z"
fill="#2F495E"
/>
</svg>
</template>

<style>
.NuxtLogo {
animation: 1s appear;
margin: auto;
}
@keyframes appear {
0% {
opacity: 0;
}
}
</style>
99 changes: 99 additions & 0 deletions components/Population.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<template>
<div class="body">
<!-- 都道府県とチェックボックスをここで描画させている -->
<h2>都道府県</h2>
<div
v-for="(prefecture, index) in prefectures"
:key="index"
class="checkbox"
>
<input
v-model="check_box_pref"
type="checkbox"
:value="prefecture"
@change="checkbox_change"
/>
{{ prefecture.prefName }}
&nbsp;&nbsp;
</div>

<time-line-chart :display-data="displayData()" />
</div>
</template>

<script>
import TimeLineChart from '@/components/TimeLineChart.vue'
export default {
components: {
TimeLineChart,
},
data() {
return {
// 都道府県名と都道府県コードを保持
prefectures: [],
// 総人口
population: [],
resasUrl: 'population/composition/perYear?',
// チェックされた都道府県名と都道府県コード
check_box_pref: [],
cityCode: '-',
}
},
created() {
this.fetchprefectures()
this.fetchSomething()
},
methods: {
displayData() {
return this.population
},
async fetchSomething(prefCode) {
const res = await this.$api(
`${this.resasUrl}prefCode=${prefCode.prefCode}&cityCode=${this.cityCode}`
)
this.population.push(
res.data.result.data
.map((item) => {
return {
info: item.label,
name: prefCode.prefName,
data: item.data.map((d) => {
return {
x: d.year,
y: d.value,
}
}),
}
})
.filter((item) => item.info === '総人口')[0]
)
this.displayData()
},
// 都道府県の名称とコードを取得
async fetchprefectures() {
const res = await this.$api('prefectures')
// 都道府県のみを取得
const PrefNameArray = res.data.result
// populationに代入
this.prefectures = PrefNameArray
},
checkbox_change() {
// checkを入れるたびにグラフを再描画
this.check_box_pref.forEach((prefCode) => {
// 一度全消去
this.population = []
this.fetchSomething(prefCode)
console.log('a')
})
},
},
}
</script>
<style scoped>
.body {
padding: 30px;
}
.checkbox {
display: inline-block;
}
</style>
7 changes: 7 additions & 0 deletions components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# COMPONENTS

**This directory is not required, you can delete it if you don't want to use it.**

The components directory contains your Vue.js Components.

_Nuxt.js doesn't supercharge these components._
Loading

0 comments on commit 0714f09

Please sign in to comment.