diff --git a/nikoli.rb b/nikoli.rb index 21ba16a..73cb521 100755 --- a/nikoli.rb +++ b/nikoli.rb @@ -7,11 +7,13 @@ require 'coffee-script' require 'slim' require 'sass' +GAMES = %i{nurikabe sudoku} + get('/application.css') { scss :application } -get('/') { slim :index } +get('/') { slim :index, locals: {games: GAMES} } -%i{nurikabe}.each do |game| +GAMES.each do |game| get("/#{game}") { slim game } get("/#{game}.js") { coffee game } end diff --git a/views/application.scss b/views/application.scss index c5b5810..6fdac91 100644 --- a/views/application.scss +++ b/views/application.scss @@ -4,12 +4,41 @@ body { margin: 0; padding: 0; } + +ul { + list-style-type: none; + padding: 0; + margin: 0; + + li { + margin: 5px 0; + + a { + background-color: #eee; + color: #000; + font-size: 1.2em; + border-radius: 3px; + padding: 15px 0; + text-decoration: none; + + display: block; + width: 100%; + height: 100%; + + &:hover { + background-color: #ccc; + } + } + } +} + #main { width: 500px; margin: 0 auto; padding: 20px; text-align: center; } + .game-container { cursor: default; font-weight: bold; diff --git a/views/index.slim b/views/index.slim index 67dee2a..6938748 100644 --- a/views/index.slim +++ b/views/index.slim @@ -1 +1,8 @@ -h1 Hello world! +- content_for(:title) { 'Nikoli games' } + +h1 Nikoli + +ul + - games.each do |game| + li + a href="#{url("/#{game}")}" #{game.capitalize}