Poprawki wizualne i zachowania strony

This commit is contained in:
2021-04-21 22:48:21 +02:00
parent d31e88260a
commit 3d9b766cc7
16 changed files with 573 additions and 494 deletions
+65
View File
@@ -0,0 +1,65 @@
<template>
<button class="action-btn">
<slot></slot>
</button>
</template>
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
@Component
export default class ActionButton extends Vue {}
</script>
<style lang="scss" scoped>
@import "../../styles/variables";
@import "../../styles/responsive";
.action-btn {
display: flex;
align-items: center;
background: #333;
border: none;
color: #bdbdbd;
font-size: 1em;
font-weight: 500;
outline: none;
padding: 0.35em 0.65em;
cursor: pointer;
transition: all 0.3s;
&.outlined {
border: 1px solid white;
}
img.button_icon {
width: 1.25em;
vertical-align: middle;
margin-right: 0.2em;
}
p {
font-size: 1em;
overflow: hidden;
transition: max-width 0.35s ease-in-out;
}
&.open {
color: $accentCol;
border: none;
}
&:hover {
color: $accentCol;
background: #5c5c5c;
}
}
</style>
+66
View File
@@ -0,0 +1,66 @@
<template>
<div class="search-box">
<input v-model="searchedItem" :placeholder="title" />
<img
class="search-exit"
:src="exitIcon"
alt="exit-icon"
@click="() => (searchedItem = '')"
/>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop, Model } from "vue-property-decorator";
@Component
export default class SearchBox extends Vue {
@Prop({ required: true }) title!: string;
@Model("changed") readonly searchedItem!: string;
// @Emit("changed")
// onItemChanged() {
// return this.searchedItem;
// }
exitIcon = require("@/assets/icon-exit.svg");
// searchedItem: string = "";
// @Watch("searchedItem")
// watchSelectedItem(item) {
// this.onItemChanged();
// }
}
</script>
<style lang="scss" scoped>
.search {
&-box {
position: relative;
background: #333;
border-radius: 0.5em;
min-width: 200px;
}
&-exit {
position: absolute;
cursor: pointer;
top: 50%;
right: 10px;
transform: translateY(-50%);
width: 1em;
}
}
input {
border: none;
min-width: 85%;
padding: 0.35em 0.5em;
}
</style>
+80 -71
View File
@@ -1,109 +1,118 @@
<template>
<div class="select-box">
<div class="title">Sortuj według</div>
<div class="select-box_content">
<label>
<select v-model="selectedItem">
<option value disabled selected hidden>
{{ title }}
</option>
<option v-for="item in itemList" :key="item.id" :value="item.id">
{{ item.value }}
</option>
</select>
<div class="option-selected" @click="toggleOptionList">
<span>{{ selectedOption }}</span>
<img :src="require('@/assets/icon-select.svg')" alt="icon-select" />
</div>
<div class="option-container">
<ul class="option-list" :class="{ open: listOpen }">
<li
class="option-item"
v-for="(option, i) in sortOptionList"
:key="i"
@click="() => chooseOption(option)"
>
<input type="option-radio" name="sort" :id="option.id" />
<label :for="option.id">{{ option.content }}</label>
</li>
</ul>
<span> </span>
</label>
</div>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";
import { Component, Vue, Prop, Watch, Emit } from "vue-property-decorator";
@Component
export default class SelectBox extends Vue {
@Prop() title!: string;
@Prop() optionList!: string[];
@Prop({ required: true }) title!: string;
@Prop({ required: true }) itemList!: { id: string | number; value: string }[];
selectedOption: string = "";
@Emit("selected")
onItemSelected() {
return this.selectedItem;
}
ascIcon = require("@/assets/icon-arrow-asc.svg");
descIcon = require("@/assets/icon-arrow-desc.svg");
selectedItem: string = "";
@Watch("selectedItem")
watchSelectedItem(item) {
this.onItemSelected();
}
}
</script>
<style lang="scss" scoped>
.option {
&-container {
@import "../../styles/variables.scss";
.select-box {
&_content {
position: relative;
input {
display: none;
}
label {
padding: 0.5rem 1rem;
width: 100%;
cursor: pointer;
}
margin: 0.5em 0;
}
&-item {
display: flex;
select {
border: none;
outline: none;
min-width: 10em;
&:hover {
background-color: rgba(#868686, 0.85);
}
transition: background 150ms ease-in;
}
&-selected,
&-list {
background: #333;
background-color: #333;
border-radius: 0.5em;
}
&-selected {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.35em 0.5em;
font-size: 1em;
color: white;
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
padding: 0.5rem 1rem;
min-width: 150px;
cursor: pointer;
span {
margin-right: 2rem;
}
img {
max-width: 0.75em;
&:focus {
+ span > img {
transform: rotate(180deg);
}
}
}
&-list {
label {
position: relative;
}
span {
$arrowCol: #d8d8d8;
$arrowWidth: 0.35em;
position: absolute;
top: 0;
left: 0;
top: 20%;
right: 0.25em;
z-index: 10;
pointer-events: none;
width: 100%;
background-color: rgba(#222, 0.95);
overflow: hidden;
&::before,
&::after {
content: "";
width: 0;
height: 0;
max-height: 0;
position: absolute;
right: 0.5em;
&.open {
max-height: 250px;
opacity: 1;
border-left: $arrowWidth solid transparent;
border-right: $arrowWidth solid transparent;
}
transition: all 150ms ease-in;
&::before {
border-top: $arrowWidth solid $arrowCol;
transform: translateY(150%);
}
&::after {
border-bottom: $arrowWidth solid $arrowCol;
}
}
}
</style>