Skip to content

Commit

Permalink
Prettier button to choose view
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJackson-Oslo committed Apr 24, 2024
1 parent fb2e1c9 commit 04ee8e4
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/assets/images/table.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 2 additions & 5 deletions app/views/spaces/index/_filters.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
<div class="md:hidden w-16"></div>
</header>

<main class="p-8 md:pt-11">
<div class="flex justify-center">
<button data-action="click->mapbox#setViewToMap" class="set-view-to-map-button button">Kart 🗺️</button>
<button data-action="click->mapbox#setViewToTable" class="set-view-to-table-button button">Tabell 📋</button>
</div>
<main class="p-8">
<%= render 'spaces/index/set_view_buttons' %>
<%= render partial: "spaces/index/search_form" %>
</main>

Expand Down
49 changes: 49 additions & 0 deletions app/views/spaces/index/_set_view_buttons.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<fieldset class="mb-8 flex flex-col items-center">
<legend class="text-center mb-1 text-xs uppercase text-gray-400 sr-only">
<%= t('space_filter.choose_view') %>
</legend>
<div class="flex justify-center shadow-lg h-fit w-fit rounded-lg">
<button
data-action="click->mapbox#setViewToMap"
aria-label="<%= t('space_filter.view_results_in_map') %>"
title="<%= t('space_filter.view_results_in_map') %>"
class="
cursor-pointer
bg-gray-100 text-gray-700
rounded-lg rounded-r-none border border-gray-100
hover:text-lnu-pink hover:border-lnu-pink
py-2 px-3
inline-flex gap-1 content-center items-center
[body.view-as-map_&]:bg-lnu-pink
[body.view-as-map_&]:border-lnu-pink
[body.view-as-map_&]:text-white
[body.view-as-map_&]:hover:text-white
[body.view-as-map_&]:hover:cursor-default
"
>
<%= inline_svg "place", class: 'h-4' %>
<%= t('space_filter.map') %>
</button>
<button
data-action="click->mapbox#setViewToTable"
aria-label="<%= t('space_filter.view_results_in_table') %>"
title="<%= t('space_filter.view_results_in_table') %>"
class="
cursor-pointer
bg-gray-100 text-gray-700
rounded-lg rounded-l-none border border-gray-100
hover:text-lnu-pink hover:border-lnu-pink
py-2 px-3
inline-flex gap-1 content-center items-center
[body.view-as-table_&]:bg-lnu-pink
[body.view-as-table_&]:border-lnu-pink
[body.view-as-table_&]:text-white
[body.view-as-table_&]:hover:text-white
[body.view-as-table_&]:hover:cursor-default
"
>
<%= t('space_filter.table') %>
<%= inline_svg "table", class: 'h-4' %>
</button>
</div>
</fieldset>
5 changes: 5 additions & 0 deletions config/locales/nb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ nb:
title: 'Navn på lokalet'
more_filters: 'Flere filtre'
map_reload: 'Søk i området'
choose_view: 'Visning'
map: 'Kart'
table: 'Tabell'
view_results_in_table: 'Vis resultater i tabell'
view_results_in_map: 'Vis resultater i kart'
admin:
user: 'Bruker'
field: 'Felt'
Expand Down

0 comments on commit 04ee8e4

Please sign in to comment.