Skip to content

Commit

Permalink
web/satellite: VInfo, VerticalArrows, VDateRangePicket migrated to us…
Browse files Browse the repository at this point in the history
…e composition api

related tests moved to ignored folder;

Change-Id: Ic76fe5f6da8088484ddcd2956bb6bb6c0d5d6223
  • Loading branch information
NikolaiYurchenko authored and Storj Robot committed Dec 15, 2022
1 parent 55774ba commit 8d30b58
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 92 deletions.
26 changes: 10 additions & 16 deletions web/satellite/src/components/common/VDateRangePicker.vue
Expand Up @@ -13,24 +13,18 @@
/>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
<script setup lang="ts">
import DatePicker from 'vue2-datepicker';
// @vue/component
@Component({
components: {
DatePicker,
},
})
export default class VDateRangePicker extends Vue {
@Prop({ default: false })
public readonly isOpen: boolean;
@Prop({ default: () => false })
public readonly onDatePick: (dateRange: Date[]) => void;
@Prop({ default: undefined })
public readonly dateRange: Date[];
}
const props = withDefaults(defineProps<{
isOpen?: boolean;
onDatePick?: (dateRange: Date[]) => void;
dateRange?: Date[];
}>(), {
isOpen: false,
onDatePick: () => () => false,
dateRange: () => [],
});
</script>

<style lang="scss">
Expand Down
53 changes: 24 additions & 29 deletions web/satellite/src/components/common/VInfo.vue
Expand Up @@ -23,41 +23,36 @@
</div>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
<script setup lang="ts">
import { ref } from 'vue';
import VButton from '@/components/common/VButton.vue';
// @vue/component
@Component({
components: {
VButton,
},
})
export default class VInfo extends Vue {
@Prop({ default: '' })
private readonly title: string;
@Prop({ default: '' })
private readonly buttonLabel: string;
@Prop({ default: () => () => false })
private readonly onButtonClick: () => unknown;
const props = withDefaults(defineProps<{
title?: string;
buttonLabel?: string;
onButtonClick?: () => unknown;
}>(), {
title: '',
buttonLabel: '',
onButtonClick: () => () => false,
});
public isVisible = false;
const isVisible = ref<boolean>(false);
/**
* Holds on button click logic.
*/
public onClick(): void {
this.onButtonClick();
this.toggleVisibility();
}
/**
* Toggles bubble visibility.
*/
function toggleVisibility(): void {
isVisible.value = !isVisible.value;
}
/**
* Toggles bubble visibility.
*/
public toggleVisibility(): void {
this.isVisible = !this.isVisible;
}
/**
* Holds on button click logic.
*/
function onClick(): void {
props.onButtonClick();
toggleVisibility();
}
</script>

Expand Down
34 changes: 12 additions & 22 deletions web/satellite/src/components/common/VerticalArrows.vue
Expand Up @@ -8,35 +8,25 @@
</div>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
<script setup lang="ts">
import { computed } from 'vue';
import { SortingDirectionEnum } from '@/types/sortingArrows';
import BottomArrowIcon from '@/../static/images/common/bottomArrow.svg';
import TopArrowIcon from '@/../static/images/common/topArrow.svg';
// @vue/component
@Component({
components: {
TopArrowIcon,
BottomArrowIcon,
},
})
export default class VerticalArrows extends Vue {
@Prop({ default: false })
private isActive: boolean;
@Prop({ default: SortingDirectionEnum.BOTTOM })
private direction: SortingDirectionEnum;
public get isTop(): boolean {
return this.direction === SortingDirectionEnum.TOP;
}
const props = withDefaults(defineProps<{
isActive?: boolean;
direction?: SortingDirectionEnum;
}>(), {
isActive: false,
direction: SortingDirectionEnum.BOTTOM,
});
public get isBottom(): boolean {
return this.direction === SortingDirectionEnum.BOTTOM;
}
}
const isTop = computed((): boolean => props.direction === SortingDirectionEnum.TOP);
const isBottom = computed((): boolean => props.direction === SortingDirectionEnum.BOTTOM);
</script>

<style scoped lang="scss">
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 8d30b58

Please sign in to comment.