web/satellite: create acces grant: duration selection logic (#3978)

This commit is contained in:
Malcolm Bouzi 2020-11-24 12:18:02 -05:00 committed by GitHub
parent 257c8682d3
commit c6626748d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 65 deletions

View File

@ -5,14 +5,14 @@
<div class="duration-picker"> <div class="duration-picker">
<div class="duration-picker__list"> <div class="duration-picker__list">
<ul class="duration-picker__list__column"> <ul class="duration-picker__list__column">
<li class="duration-picker__list__column-item">Forever</li> <li v-on:click="onDurationClick" class="duration-picker__list__column-item">Forever</li>
<li class="duration-picker__list__column-item">1 month</li> <li v-on:click="onDurationClick" class="duration-picker__list__column-item">1 month</li>
<li class="duration-picker__list__column-item">24 Hours</li> <li v-on:click="onDurationClick" class="duration-picker__list__column-item">24 Hours</li>
</ul> </ul>
<ul class="duration-picker__list__column"> <ul class="duration-picker__list__column">
<li class="duration-picker__list__column-item">6 Months</li> <li v-on:click="onDurationClick" class="duration-picker__list__column-item">6 Months</li>
<li class="duration-picker__list__column-item">1 Week</li> <li v-on:click="onDurationClick" class="duration-picker__list__column-item">1 Week</li>
<li class="duration-picker__list__column-item">1 Year</li> <li v-on:click="onDurationClick" class="duration-picker__list__column-item">1 Year</li>
</ul> </ul>
</div> </div>
<hr class="duration-picker__break"> <hr class="duration-picker__break">
@ -20,8 +20,12 @@
<DatePicker <DatePicker
range range
open open
:append-to-body="false"
:inline="true"
v-model="date"
popup-class="duration-picker__date-picker__popup" popup-class="duration-picker__date-picker__popup"
input-class="duration-picker__date-picker__input" input-class="duration-picker__date-picker__input"
@change="onDateChange($event)"
/> />
</div> </div>
</div> </div>
@ -31,14 +35,30 @@
import { Component, Vue } from 'vue-property-decorator'; import { Component, Vue } from 'vue-property-decorator';
import DatePicker from 'vue2-datepicker'; import DatePicker from 'vue2-datepicker';
import 'vue2-datepicker/index.css'; import 'vue2-datepicker/index.css';
@Component({ @Component({
components: { components: {
DatePicker, DatePicker,
}, },
}) })
export default class DurationPicker extends Vue { export default class DurationPicker extends Vue {
private duration: string = '';
private dateRange: string[] = [];
/**
* When date range value changes
* @param dateRange
*/
public onDateChange(date): void {
this.dateRange = date;
}
/**
* When duration button is clicked
* @param duration
*/
public onDurationClick(event): void {
this.duration = event.target.textContent;
}
} }
</script> </script>
@ -46,7 +66,7 @@ export default class DurationPicker extends Vue {
.duration-picker { .duration-picker {
background: #fff; background: #fff;
width: 530px; width: 530px;
height: 595px; height: 400px;
border: 1px solid #384b65; border: 1px solid #384b65;
margin: 0 auto; margin: 0 auto;
-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); -webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
@ -55,30 +75,24 @@ export default class DurationPicker extends Vue {
position: absolute; position: absolute;
z-index: 1; z-index: 1;
right: 0; right: 0;
left: 0; top: 100%;
top: 190px;
&__list { &__list {
-moz-column-count: 2; -moz-column-count: 2;
-moz-column-gap: 48px; -moz-column-gap: 48px;
-webkit-column-count: 2; -webkit-column-count: 2;
column-count: 2; column-count: 2;
padding: 18px 24px 0; padding: 10px 24px 0;
&__column { &__column {
list-style-type: none; list-style-type: none;
padding-left: 0; padding-left: 0;
margin-top: 0; margin-top: 0;
} }
&__column-item { &__column-item {
font-size: 14px; font-size: 14px;
margin-bottom: 10px;
font-weight: 400; font-weight: 400;
padding: 15px 0 15px 12px; padding: 10px 0 10px 12px;
border-left: 7px solid #fff; border-left: 7px solid #fff;
color: #1b2533; color: #1b2533;
&:hover { &:hover {
font-weight: bold; font-weight: bold;
background: #f5f6fa; background: #f5f6fa;
@ -87,36 +101,42 @@ export default class DurationPicker extends Vue {
} }
} }
} }
&__break { &__break {
width: 84%; width: 84%;
margin: 0 auto;
} }
&__date-picker { &__date-picker {
&__wrapper { &__wrapper {
text-align: center; position: relative;
margin: 30px auto; margin: 0;
} }
} }
} }
</style> </style>
<style lang="scss"> <style lang="scss">
.duration-picker { .duration-picker {
&__date-picker { &__date-picker {
&__popup { &__popup {
top: 70% !important; position: absolute;
left: 210px !important; top: 0;
right: 0; left: 25px;
margin-left: auto;
margin-right: auto;
width: 480px; width: 480px;
height: 210px;
} }
} }
} }
.mx-calendar {
height: 210px;
}
.mx-table-date td, .mx-table-date th {
height: 12px;
font-size: 10px;
}
.mx-table {
height: 70%;
}
</style> </style>

View File

@ -5,60 +5,78 @@
<div class="duration-selection"> <div class="duration-selection">
<div <div
class="duration-selection__toggle-container" class="duration-selection__toggle-container"
@click="toggleDurationPicker" @click="togglePicker"
> >
<h1 class="duration-selection__toggle-container__name">Forever</h1> <h1 class="duration-selection__toggle-container__name">Forever</h1>
<ExpandIcon <ExpandIcon
class="duration-selection__toggle-container__expand-icon" class="duration-selection__toggle-container__expand-icon"
alt="Arrow down (expand)" alt="Arrow down (expand)"
/>
</div>
<DurationPicker
v-if="isDurationPickerVisible"
/> />
</div> </div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator'; import { Component, Vue } from 'vue-property-decorator';
import DurationPicker from '@/components/accessGrants/permissions/DurationPicker.vue';
import ExpandIcon from '@/../static/images/common/BlackArrowExpand.svg'; import ExpandIcon from '@/../static/images/common/BlackArrowExpand.svg';
@Component({ @Component({
components: { components: {
ExpandIcon, ExpandIcon,
DurationPicker,
}, },
}) })
export default class DurationSelection extends Vue { export default class DurationSelection extends Vue {
public isDurationPickerVisible: boolean = false;
/**
* Toggles duration picker.
*/
public togglePicker(): void {
this.isDurationPickerVisible = !this.isDurationPickerVisible;
}
/**
* Closes duration picker.
*/
public closePicker(): void {
this.isDurationPickerVisible = false;
}
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.duration-selection { .duration-selection {
background-color: #fff; background-color: #fff;
cursor: pointer; cursor: pointer;
margin-left: 15px; margin-left: 15px;
border-radius: 6px; border-radius: 6px;
border: 1px solid rgba(56, 75, 101, 0.4); border: 1px solid rgba(56, 75, 101, 0.4);
font-family: 'font_regular', sans-serif; font-family: 'font_regular', sans-serif;
width: 235px; width: 235px;
&__toggle-container {
position: relative; position: relative;
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px 20px;
width: calc(100% - 40px);
&__name { &__toggle-container {
font-style: normal; display: flex;
font-weight: normal; align-items: center;
font-size: 16px; justify-content: space-between;
line-height: 21px; padding: 15px 20px;
color: #384b65; width: calc(100% - 40px);
margin: 0;
&__name {
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 21px;
color: #384b65;
margin: 0;
}
} }
} }
}
</style> </style>

View File

@ -31,7 +31,6 @@
<div class="permissions__content__right__duration-select"> <div class="permissions__content__right__duration-select">
<p class="permissions__content__right__duration-select__label">Duration</p> <p class="permissions__content__right__duration-select__label">Duration</p>
<DurationSelection /> <DurationSelection />
<DurationPicker/>
</div> </div>
<div class="permissions__content__right__buckets-select"> <div class="permissions__content__right__buckets-select">
<p class="permissions__content__right__buckets-select__label">Buckets</p> <p class="permissions__content__right__buckets-select__label">Buckets</p>
@ -67,7 +66,6 @@ import { Component, Vue } from 'vue-property-decorator';
import BucketNameBullet from '@/components/accessGrants/permissions/BucketNameBullet.vue'; import BucketNameBullet from '@/components/accessGrants/permissions/BucketNameBullet.vue';
import BucketsSelection from '@/components/accessGrants/permissions/BucketsSelection.vue'; import BucketsSelection from '@/components/accessGrants/permissions/BucketsSelection.vue';
import DurationPicker from '@/components/accessGrants/permissions/DurationPicker.vue';
import DurationSelection from '@/components/accessGrants/permissions/DurationSelection.vue'; import DurationSelection from '@/components/accessGrants/permissions/DurationSelection.vue';
import VButton from '@/components/common/VButton.vue'; import VButton from '@/components/common/VButton.vue';
@ -81,7 +79,6 @@ import { BUCKET_ACTIONS } from '@/store/modules/buckets';
BackIcon, BackIcon,
BucketsSelection, BucketsSelection,
BucketNameBullet, BucketNameBullet,
DurationPicker,
DurationSelection, DurationSelection,
VButton, VButton,
}, },