-
Notifications
You must be signed in to change notification settings - Fork 1
Added VDockableCard VCardDock and VSlottedSelect #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
caiodark
wants to merge
3
commits into
master
Choose a base branch
from
card-components
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<div class="card-dock w-100 d-flex flex-column flex-xl-row"> | ||
<div class="col"> | ||
<slot name="leftCol"> | ||
</slot> | ||
</div> | ||
<div class="col" v-if="hasRightCol()"> | ||
<slot name="rightCol"> | ||
</slot> | ||
</div> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
import { Vue, Component } from 'vue-property-decorator'; | ||
|
||
@Component | ||
export default class CardDock extends Vue { | ||
hasRightCol() { | ||
return !!this.$slots.rightCol || !!this.$scopedSlots.rightCol; | ||
} | ||
} | ||
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<template> | ||
<div class="v-dockable-card shadow-sm w-100"> | ||
<div class="v-dockable-card-header" v-if="showHeader"> | ||
<slot name="header"> | ||
<h6>{{title}}</h6> | ||
</slot> | ||
</div> | ||
<div class="v-dockable-card-container"> | ||
<slot name="body"> | ||
<p>Body</p> | ||
</slot> | ||
</div> | ||
<div class="v-dockable-card-footer" v-if="hasFooter"> | ||
<slot name="footer"> | ||
</slot> | ||
</div> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spazia , <script> e <style> |
||
import { Component, Vue, Prop } from 'vue-property-decorator'; | ||
|
||
@Component | ||
export default class VCard extends Vue { | ||
@Prop({ default: () => 'Titolo' }) readonly title!: string; | ||
@Prop({ default: true }) readonly showHeader!: boolean; | ||
|
||
get hasFooter() { | ||
return !!this.$slots.footer | ||
} | ||
} | ||
|
||
</script> | ||
<style lang="scss" scoped> | ||
@import '@/css/vue'; | ||
.v-dockable-card { | ||
background-color: $white; | ||
border: 1px solid $athens-gray; | ||
caiodark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
&-header { | ||
padding: 1rem 0.5rem; | ||
border-bottom: 1px solid $athens-gray; | ||
h6 { | ||
margin: 0; | ||
} | ||
} | ||
&-container { | ||
padding: 1rem 0.5rem; | ||
} | ||
&-footer { | ||
border-top: 1px solid $athens-gray; | ||
padding: 1rem 0.5rem; | ||
} | ||
} | ||
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<template> | ||
<div class="slotted-select" v-click-outside="closeDropdown"> | ||
<div class="form-group"> | ||
<label>{{label}}</label> | ||
<div class="slotted-select-selected d-flex h-100" @click="toggle"> | ||
<slot name="selected" :selected="selectedItem"> | ||
</slot> | ||
</div> | ||
</div> | ||
<div class="w-100 slotted-select-options shadow-sm " v-if="isOpen" :style="{'height': dropDownSize+'px'}"> | ||
<div class="slotted-select-options-grouped" v-if="hasGroups"> | ||
<div class="slotted-select-options-grouped-block" v-for="group in groups" :key="group.name"> | ||
<div class="slotted-select-options-grouped-block-header"> | ||
<slot name="group-header" v-bind:group="group"> | ||
</slot> | ||
</div> | ||
<div class="slotted-select-options-items d-flex h-100" v-for="item in group.items" :key="item.id" @click="select(item, group)"> | ||
<slot name="item" v-bind:item="item"> | ||
</slot> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="slotted-select-options-grouped" v-else> | ||
<div class="slotted-select-options-items d-flex h-100" v-for="item in items" :key="item.id" @click="select(item)"> | ||
<slot name="item" :item="item"> | ||
</slot> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
caiodark marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import { Component, Vue, Prop } from 'vue-property-decorator'; | ||
import ClickOutside from '../directives/ClickOutside'; | ||
|
||
export type SlottedSelectGroup = { | ||
id: string; | ||
name: string; | ||
items: SlottedSelectItem[]; | ||
} | ||
|
||
export type SlottedSelectItem = { | ||
icon: string | null; | ||
id: string; | ||
text: string; | ||
additional: string | null; | ||
} | ||
|
||
@Component({ directives: { ClickOutside } }) | ||
export default class VSlottedSelect extends Vue { | ||
@Prop({ default: 'Label' }) readonly label!: string; | ||
@Prop({ required: true }) readonly selected!: SlottedSelectItem; | ||
@Prop({ default: () => { return [] } }) readonly items!: SlottedSelectItem[]; | ||
@Prop({ default: () => { return [] } }) readonly groups!: SlottedSelectGroup[]; | ||
@Prop({ default: 400 }) readonly dropDownSize!: number; | ||
|
||
private selectedItem = Object.assign({}, this.selected); | ||
isOpen = false; | ||
|
||
get hasGroups() { | ||
return this.groups.length > 0; | ||
} | ||
|
||
toggle() { | ||
this.isOpen = !this.isOpen; | ||
} | ||
|
||
closeDropdown() { | ||
this.isOpen = false; | ||
} | ||
|
||
select(item: SlottedSelectItem, group?: SlottedSelectGroup) { | ||
this.selectedItem = item; | ||
this.$emit('selected', item, group); | ||
this.isOpen = false; | ||
} | ||
} | ||
</script> | ||
<style lang="scss" scoped> | ||
@import "@/css/vue"; | ||
.slotted-select { | ||
color: $black; | ||
width: 100%; | ||
user-select: none; | ||
position: relative; | ||
.form-group { | ||
label { | ||
color: $black; | ||
} | ||
margin-bottom: 5px; | ||
} | ||
&-selected { | ||
background-color: $white; | ||
border-radius: 4px; | ||
padding: .5rem 1rem; | ||
border: 1px solid $gray-300; | ||
color: $black; | ||
} | ||
&-options { | ||
z-index: 11; | ||
overflow-y: auto; | ||
background-color: $white; | ||
position: absolute; | ||
border-radius: 4px; | ||
border: 1px solid $gray-300; | ||
&-items { | ||
padding: .25rem 1rem 0.25rem 1rem; | ||
} | ||
&-items:first-child { | ||
padding: .5rem 1rem 0.25rem 1rem; | ||
} | ||
&-items:last-child { | ||
padding: .25rem 1rem 0.5rem 1rem; | ||
} | ||
&-items:hover { | ||
background-color: $primary; | ||
color: $white; | ||
} | ||
&-grouped-block-header { | ||
padding: 0.125rem; | ||
} | ||
} | ||
} | ||
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<template> | ||
<div class="medium-selector-item w-100 d-flex justify-content-between"> | ||
<div class="d-flex align-items-center"> | ||
<v-icon size="lg">{{item.icon}}</v-icon> | ||
<span class="ml-2">{{item.text}}</span> | ||
</div> | ||
<div class="d-flex align-items-center"> | ||
<span class="text-muted">{{item.additional}}</span> | ||
<v-icon size="xs" class="ml-2" v-if="hasChevron">chevron-down</v-icon> | ||
</div> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
import { Component, Prop, Vue } from 'vue-property-decorator'; | ||
import { SlottedSelectItem } from './VSlottedSelect.vue'; | ||
import VIcon from './VIcon.vue'; | ||
|
||
@Component({ components: { VIcon } }) | ||
export default class MediumSelectorItem extends Vue { | ||
@Prop({ required: true }) readonly item!: SlottedSelectItem; | ||
@Prop({ default: false }) readonly hasChevron!: boolean; | ||
} | ||
</script> | ||
<style lang="scss" scoped> | ||
</style> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.