Skip to content

Commit

Permalink
allow theming individual pages with data attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
niwla23 committed Jun 25, 2022
1 parent d574b6c commit ddb345e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "smartdashboard",
"version": "2.0.0",
"version": "2.1.0",
"private": true,
"scripts": {
"dev": "nuxt-ts",
"build": "nuxt-ts build",
"start": "nuxt-ts start",
"generate": "nuxt-ts generate",
"pack-dist": "tar -czf smartdashboard.tar.gz dist",
"pack-dist": "tar -czf smartdashboard-v$(cat package.json | jq .version -r).tar.gz dist",
"lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
"lint": "yarn lint:js",
"test": "jest"
Expand Down
24 changes: 5 additions & 19 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,12 @@
<link rel="stylesheet" :href="stylesheetUrl" />
<Slider v-if="$store.state.sliderOverlayShown" />
<Colorpicker v-if="$store.state.colorpickerOverlayShown" />
<div
v-hammer:swipe.left="nextPage"
v-hammer:pan="swipeUp"
class="grid auto-rows-fr gap-6 h-screen p-4 bg-cover smartdashboard-bg"
:style="{
<div v-hammer:swipe.left="nextPage" v-hammer:pan="swipeUp"
class="grid auto-rows-fr gap-6 h-screen p-4 bg-cover smartdashboard-bg" :style="{
'grid-template-columns': `repeat(${pageConfig.columns}, minmax(0, 1fr))`,
}"
>
<Item
v-for="item in pageConfig.items"
:key="item.item_name"
:cell-color="pageConfig.box_color"
:active-color="pageConfig.active_color"
:border-color="pageConfig.border_color"
:border-width="pageConfig.border_width"
:item-name="item.item_name"
:label="item.label"
:suffix="item.suffix"
:refresh="pageConfig.refresh"
/>
}" :data-page-name="pageConfig.name">
<Item v-for="item in pageConfig.items" :key="item.item_name" :item-name="item.item_name" :label="item.label"
:suffix="item.suffix" :refresh="pageConfig.refresh" />
</div>
</main>
</template>
Expand Down
8 changes: 8 additions & 0 deletions static/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
padding: 2rem;
}

[data-page-name="sirens"] {
background-color: red;
}

[data-page-name="sirens"] > .smartdashboard-box {
background-color: rgb(0, 255, 221);
}

.smartdashboard-box {
background-color: rgb(44, 44, 44);
box-shadow: 0px 0px 26px -3px rgba(0, 0, 0, 0.5);
Expand Down

0 comments on commit ddb345e

Please sign in to comment.