-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
395 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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,92 @@ | ||
<script setup> | ||
import { computed } from 'vue' | ||
import PhosphorIcon from '@/components/PhosphorIcon' | ||
const props = defineProps({ | ||
compact: { | ||
type: Boolean | ||
}, | ||
active: { | ||
type: Boolean | ||
}, | ||
title: { | ||
type: String | ||
}, | ||
to: { | ||
type: Object | ||
}, | ||
actionTo: { | ||
type: Object | ||
}, | ||
actionIcon: { | ||
type: String, | ||
default: 'plus' | ||
}, | ||
actionTitle: { | ||
type: String | ||
}, | ||
icon: { | ||
type: String | ||
} | ||
}) | ||
const classList = computed(() => { | ||
return { | ||
'app-sidebar-section-entry--compact': props.compact, | ||
'app-sidebar-section-entry--active': props.active | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div class="app-sidebar-section-entry d-flex align-entrys-center flex-truncate" :class="classList"> | ||
<router-link :to="to" class="app-sidebar-section-entry__link text-truncate flex-grow-1"> | ||
<phosphor-icon class="app-sidebar-section-entry__link__icon me-2" :name="icon" /> | ||
<slot>{{ title }}</slot> | ||
</router-link> | ||
<router-link | ||
v-if="actionTo" | ||
v-b-tooltip.right | ||
:to="actionTo" | ||
class="app-sidebar-section-entry__action ms-2" | ||
:title="actionTitle" | ||
> | ||
<phosphor-icon class="app-sidebar-section-entry__action__icon" hover-weight="bold" :name="actionIcon" /> | ||
<span class="visually-hidden">{{ actionTitle }}</span> | ||
</router-link> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.app-sidebar-section-entry { | ||
position: relative; | ||
&--active:before { | ||
content: ''; | ||
position: absolute; | ||
left: -$spacer-xs; | ||
top: $spacer-xxs; | ||
bottom: $spacer-xxs; | ||
width: 2px; | ||
border-radius: 1px; | ||
background: var(--bs-secondary); | ||
} | ||
&__action-icon { | ||
cursor: pointer; | ||
width: $font-size-base * $line-height-base; | ||
height: $font-size-base * $line-height-base; | ||
} | ||
&__link, | ||
&__action { | ||
cursor: pointer; | ||
color: inherit; | ||
&:hover { | ||
color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1)); | ||
} | ||
} | ||
} | ||
</style> |
This file contains 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,38 @@ | ||
<script setup> | ||
import { computed } from 'vue' | ||
import PhosphorIcon from '@/components/PhosphorIcon' | ||
const props = defineProps({ | ||
compact: { | ||
type: Boolean | ||
}, | ||
title: { | ||
type: String | ||
}, | ||
icon: { | ||
type: String | ||
} | ||
}) | ||
const classList = computed(() => { | ||
return { | ||
'app-sidebar-section-title--compact': props.compact | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<h3 class="app-sidebar-section-title" :class="classList"> | ||
<phosphor-icon class="me-2" :name="icon" /> | ||
<slot>{{ title }}</slot> | ||
</h3> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.app-sidebar-section-title { | ||
font-size: 1em; | ||
font-weight: bold; | ||
margin: 0; | ||
} | ||
</style> |
This file contains 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,58 @@ | ||
<script setup> | ||
import { computed } from 'vue' | ||
import IconButton from '@/components/IconButton' | ||
const props = defineProps({ | ||
active: { | ||
type: Boolean | ||
}, | ||
title: { | ||
type: String | ||
}, | ||
icon: { | ||
type: String | ||
}, | ||
to: { | ||
type: Object | ||
} | ||
}) | ||
const classList = computed(() => { | ||
return { | ||
'app-sidebar-section-toggler--active': props.active | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<icon-button | ||
v-b-tooltip.right | ||
:icon-left="icon" | ||
square | ||
hide-label | ||
variant="outline-primary" | ||
class="app-sidebar-section-toggler" | ||
:title="title" | ||
:class="classList" | ||
> | ||
{{ title }} | ||
</icon-button> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.app-sidebar-section-toggler { | ||
border-color: transparent; | ||
width: calc(#{$btn-line-height * $btn-font-size} + #{$spacer * 2} + #{$btn-border-width} * 2); | ||
height: calc(#{$btn-line-height * $btn-font-size} + #{$spacer * 2} + #{$btn-border-width} * 2); | ||
&:not(:hover) { | ||
color: var(--bs-body-color, inherit); | ||
background: var(--bs-body-bg); | ||
} | ||
&--active { | ||
border-color: var(--bs-secondary); | ||
} | ||
} | ||
</style> |
This file contains 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
This file contains 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,54 @@ | ||
import { vueRouter } from 'storybook-vue3-router' | ||
|
||
import AppSidebarSectionEntry from '@/components/AppSidebarSectionEntry' | ||
|
||
const routes = [{ path: '/', name: 'home' }] | ||
|
||
export default { | ||
decorators: [vueRouter(routes)], | ||
title: 'Components/AppSidebar/Section/Entry', | ||
tags: ['autodocs'], | ||
argTypes: { | ||
icon: { | ||
control: { type: 'text' } | ||
}, | ||
content: { | ||
control: { type: 'text' } | ||
}, | ||
active: { | ||
control: { type: 'boolean' } | ||
} | ||
}, | ||
args: { | ||
icon: 'clock-counter-clockwise', | ||
content: 'Visited documents', | ||
active: false | ||
}, | ||
render: (args) => ({ | ||
components: { | ||
AppSidebarSectionEntry | ||
}, | ||
setup() { | ||
return { args } | ||
}, | ||
template: ` | ||
<div class="card card-body border-0" style="max-width: 270px"> | ||
<app-sidebar-section-entry v-bind="args" :to="{ name: 'home' }"> | ||
{{ args.content }} | ||
</app-sidebar-section-entry> | ||
</div> | ||
` | ||
}) | ||
} | ||
|
||
export const Default = {} | ||
|
||
export const WithAction = { | ||
args: { | ||
content: 'Batch search', | ||
icon: 'list-magnifying-glass', | ||
actionIcon: 'plus', | ||
actionTitle: 'Add batch search', | ||
actionTo: { name: 'home' } | ||
} | ||
} |
Oops, something went wrong.