refactor. Add municipality resource file.
This commit is contained in:
parent
07fb03069d
commit
1026ec08b3
|
@ -7,12 +7,10 @@
|
|||
"@types/node": "^8.0.10",
|
||||
"@types/react": "^15.0.37",
|
||||
"@types/react-dom": "^15.5.1",
|
||||
"@types/react-router-dom": "^4.0.7",
|
||||
"inuitcss": "^6.0.0-beta.5",
|
||||
"node-sass-chokidar": "^0.0.3",
|
||||
"react": "^15.6.1",
|
||||
"react-dom": "^15.6.1",
|
||||
"react-router-dom": "^4.1.1",
|
||||
"react-scripts-ts": "2.4.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
|
|
24
src/App.tsx
24
src/App.tsx
|
@ -1,22 +1,14 @@
|
|||
import * as React from 'react'
|
||||
import { Route } from 'react-router-dom'
|
||||
import MunicipalityList from './MunicipalityList'
|
||||
import Municipality from './Municipality'
|
||||
|
||||
export default () =>
|
||||
<div>
|
||||
<Route exact={true} path="/">
|
||||
<div>
|
||||
<h1>kommunelogo.nilsnh.no</h1>
|
||||
<p>
|
||||
Det er framleis for vanskeleg å finne frem til kommunelogoar. Denne
|
||||
sida freister å bøte på denne mangelen.
|
||||
</p>
|
||||
<p>Ynskjer du å bidra? Les meir her.</p>
|
||||
<MunicipalityList />
|
||||
</div>
|
||||
</Route>
|
||||
<div>
|
||||
<Route path="/kommune/:code" component={Municipality} />
|
||||
</div>
|
||||
<h1>kommunelogo.nilsnh.no</h1>
|
||||
<p>
|
||||
Det er framleis for vanskeleg å finne frem til kommunelogoar. Målet med
|
||||
denne sida er å vere ein oversiktsressurs for å raskt kunne hente ned
|
||||
logofiler, visuell profil o.l. for kommuner.
|
||||
</p>
|
||||
<p>Ynskjer du å bidra? Les meir her.</p>
|
||||
<MunicipalityList />
|
||||
</div>
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
import * as React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import ssbMunicipalities from './ssb-2017-municipality-data'
|
||||
|
||||
export default ({ match }: any) => {
|
||||
const matchingMunicipality = ssbMunicipalities.filter(
|
||||
elem => elem.code === Number.parseInt(match.params.code)
|
||||
)
|
||||
let municipality = { name: 'Fant ikke kommune' }
|
||||
if (matchingMunicipality) {
|
||||
municipality = matchingMunicipality[0]
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<p>
|
||||
<Link to="/">Tilbake</Link>
|
||||
</p>
|
||||
<p>
|
||||
Valgt kommune: {municipality.name}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
|
@ -1,12 +1,11 @@
|
|||
import * as React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
export const MunicipalityCard: React.SFC<any> = ({ muni }: any) => {
|
||||
return (
|
||||
<div className="c-municard">
|
||||
<Link className="c-municard__item" to={`/kommune/${muni.code}`}>
|
||||
<div className="c-municard__item">
|
||||
{muni.name}
|
||||
</Link>
|
||||
</div>
|
||||
<div className="c-municard__item">
|
||||
{muni.code}
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as React from 'react'
|
||||
import ssbMunicipalities from './ssb-2017-municipality-data'
|
||||
import { SSBMunicipality } from './ssb-2017-municipality-data'
|
||||
import ssbMunicipalities from './municipality-data-ssb'
|
||||
import { SSBMunicipality } from './municipality-data-ssb'
|
||||
import { MunicipalityCard } from './MunicipalityCard'
|
||||
|
||||
export default class MunicipalityList extends React.Component<any, any> {
|
||||
|
@ -41,6 +41,12 @@ export default class MunicipalityList extends React.Component<any, any> {
|
|||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div className="u-padding-bottom">
|
||||
<label>
|
||||
Vis kun de med logo tilgjengelig:
|
||||
<input type="checkbox" />
|
||||
</label>
|
||||
</div>
|
||||
{municipalities.map((elem: SSBMunicipality) =>
|
||||
<MunicipalityCard key={elem.code} muni={elem} />
|
||||
)}
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
import * as React from 'react'
|
||||
import * as ReactDOM from 'react-dom'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
import App from './App'
|
||||
import registerServiceWorker from './registerServiceWorker'
|
||||
import './css/index.css'
|
||||
|
||||
ReactDOM.render(
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>,
|
||||
document.getElementById('root') as HTMLElement
|
||||
)
|
||||
ReactDOM.render(<App />, document.getElementById('root') as HTMLElement)
|
||||
registerServiceWorker()
|
||||
|
|
13
src/municipality-data-resources.ts
Normal file
13
src/municipality-data-resources.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
interface MunicipalityResource {
|
||||
code: number // muni number
|
||||
homepageUrl: string
|
||||
resources: Array<any>
|
||||
}
|
||||
|
||||
export const MunicipalityResources: MunicipalityResource[] = [
|
||||
{
|
||||
code: 1622,
|
||||
homepageUrl: 'https://www.agdenes.kommune.no',
|
||||
resources: []
|
||||
}
|
||||
]
|
|
@ -9,6 +9,10 @@ export interface SSBMunicipality {
|
|||
validTo: string
|
||||
}
|
||||
|
||||
/**
|
||||
* SSB Municipality data
|
||||
* source: https://data.norge.no/data/statistisk-sentralbyrå/kommuneinndeling
|
||||
*/
|
||||
export default [
|
||||
{
|
||||
code: 101,
|
82
yarn.lock
82
yarn.lock
|
@ -9,10 +9,6 @@
|
|||
address "^1.0.1"
|
||||
debug "^2.6.0"
|
||||
|
||||
"@types/history@*":
|
||||
version "4.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/history/-/history-4.6.0.tgz#093d67ed780d889c9543f6dca24ebee0b6b9fc45"
|
||||
|
||||
"@types/jest@^20.0.2":
|
||||
version "20.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-20.0.2.tgz#86c751121fb53dbd39bb1a08c45083da13f2dc67"
|
||||
|
@ -27,21 +23,6 @@
|
|||
dependencies:
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/react-router-dom@^4.0.7":
|
||||
version "4.0.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-4.0.7.tgz#65b192f7a5dbd1c05a8d04cc5863c9775705a435"
|
||||
dependencies:
|
||||
"@types/history" "*"
|
||||
"@types/react" "*"
|
||||
"@types/react-router" "*"
|
||||
|
||||
"@types/react-router@*":
|
||||
version "4.0.14"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-router/-/react-router-4.0.14.tgz#dd650f40bbb20ad1fec26471707665908efa9e9f"
|
||||
dependencies:
|
||||
"@types/history" "*"
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/react@*", "@types/react@^15.0.37":
|
||||
version "15.0.37"
|
||||
resolved "https://registry.yarnpkg.com/@types/react/-/react-15.0.37.tgz#e6391cdd4ffce7050b8a290b23611a61f2411da5"
|
||||
|
@ -1983,16 +1964,6 @@ highlight.js@^9.6.0:
|
|||
version "9.12.0"
|
||||
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e"
|
||||
|
||||
history@^4.5.1, history@^4.6.0:
|
||||
version "4.6.3"
|
||||
resolved "https://registry.yarnpkg.com/history/-/history-4.6.3.tgz#6d723a8712c581d6bef37e8c26f4aedc6eb86967"
|
||||
dependencies:
|
||||
invariant "^2.2.1"
|
||||
loose-envify "^1.2.0"
|
||||
resolve-pathname "^2.0.0"
|
||||
value-equal "^0.2.0"
|
||||
warning "^3.0.0"
|
||||
|
||||
hmac-drbg@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
|
||||
|
@ -2005,10 +1976,6 @@ hoek@2.x.x:
|
|||
version "2.16.3"
|
||||
resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed"
|
||||
|
||||
hoist-non-react-statics@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz#aa448cf0986d55cc40773b17174b7dd066cb7cfb"
|
||||
|
||||
home-or-tmp@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
|
||||
|
@ -2221,7 +2188,7 @@ inuitcss@^6.0.0-beta.5:
|
|||
dependencies:
|
||||
sass-mq "^3.2.9"
|
||||
|
||||
invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2:
|
||||
invariant@^2.2.0:
|
||||
version "2.2.2"
|
||||
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360"
|
||||
dependencies:
|
||||
|
@ -2965,7 +2932,7 @@ longest@^1.0.1:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
|
||||
|
||||
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1:
|
||||
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
|
||||
dependencies:
|
||||
|
@ -3074,11 +3041,7 @@ miller-rabin@^4.0.0:
|
|||
bn.js "^4.0.0"
|
||||
brorand "^1.0.1"
|
||||
|
||||
"mime-db@>= 1.27.0 < 2":
|
||||
version "1.29.0"
|
||||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.29.0.tgz#48d26d235589651704ac5916ca06001914266878"
|
||||
|
||||
mime-db@~1.27.0:
|
||||
"mime-db@>= 1.27.0 < 2", mime-db@~1.27.0:
|
||||
version "1.27.0"
|
||||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.27.0.tgz#820f572296bbd20ec25ed55e5b5de869e5436eb1"
|
||||
|
||||
|
@ -3567,7 +3530,7 @@ path-to-regexp@0.1.7:
|
|||
version "0.1.7"
|
||||
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
|
||||
|
||||
path-to-regexp@^1.0.1, path-to-regexp@^1.5.3:
|
||||
path-to-regexp@^1.0.1:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d"
|
||||
dependencies:
|
||||
|
@ -3949,7 +3912,7 @@ promise@7.1.1, promise@^7.1.1:
|
|||
dependencies:
|
||||
asap "~2.0.3"
|
||||
|
||||
prop-types@^15.5.10, prop-types@^15.5.4:
|
||||
prop-types@^15.5.10:
|
||||
version "15.5.10"
|
||||
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
|
||||
dependencies:
|
||||
|
@ -4111,27 +4074,6 @@ react-error-overlay@^1.0.6:
|
|||
settle-promise "1.0.0"
|
||||
source-map "0.5.6"
|
||||
|
||||
react-router-dom@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.1.1.tgz#3021ade1f2c160af97cf94e25594c5f294583025"
|
||||
dependencies:
|
||||
history "^4.5.1"
|
||||
loose-envify "^1.3.1"
|
||||
prop-types "^15.5.4"
|
||||
react-router "^4.1.1"
|
||||
|
||||
react-router@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.1.1.tgz#d448f3b7c1b429a6fbb03395099949c606b1fe95"
|
||||
dependencies:
|
||||
history "^4.6.0"
|
||||
hoist-non-react-statics "^1.2.0"
|
||||
invariant "^2.2.2"
|
||||
loose-envify "^1.3.1"
|
||||
path-to-regexp "^1.5.3"
|
||||
prop-types "^15.5.4"
|
||||
warning "^3.0.0"
|
||||
|
||||
react-scripts-ts@2.4.0:
|
||||
version "2.4.0"
|
||||
resolved "https://registry.yarnpkg.com/react-scripts-ts/-/react-scripts-ts-2.4.0.tgz#52c8dd601dcdbe1c4de09e7b98534cb8de9e7cac"
|
||||
|
@ -4380,10 +4322,6 @@ requires-port@1.0.x, requires-port@1.x.x:
|
|||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
|
||||
|
||||
resolve-pathname@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.1.0.tgz#e8358801b86b83b17560d4e3c382d7aef2100944"
|
||||
|
||||
resolve@1.1.7:
|
||||
version "1.1.7"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
|
||||
|
@ -5234,10 +5172,6 @@ validate-npm-package-license@^3.0.1:
|
|||
spdx-correct "~1.0.0"
|
||||
spdx-expression-parse "~1.0.0"
|
||||
|
||||
value-equal@^0.2.0:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.2.1.tgz#c220a304361fce6994dbbedaa3c7e1a1b895871d"
|
||||
|
||||
vary@~1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.1.tgz#67535ebb694c1d52257457984665323f587e8d37"
|
||||
|
@ -5264,12 +5198,6 @@ walker@~1.0.5:
|
|||
dependencies:
|
||||
makeerror "1.0.x"
|
||||
|
||||
warning@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/warning/-/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c"
|
||||
dependencies:
|
||||
loose-envify "^1.0.0"
|
||||
|
||||
watch@~0.10.0:
|
||||
version "0.10.0"
|
||||
resolved "https://registry.yarnpkg.com/watch/-/watch-0.10.0.tgz#77798b2da0f9910d595f1ace5b0c2258521f21dc"
|
||||
|
|
Loading…
Reference in a new issue