Merge pull request #10 from shariquerik/listview-layout-change

This commit is contained in:
Shariq Ansari 2023-09-20 19:48:13 +05:30 committed by GitHub
commit ffc8070c42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 86 additions and 75 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="flex"> <div class="flex border-b pr-5">
<div id="app-header" class="flex-1"></div> <div id="app-header" class="flex-1"></div>
<div class="flex items-center justify-center"> <div class="flex items-center justify-center">
<CallUI /> <CallUI />

View File

@ -107,7 +107,7 @@
</div> </div>
<div <div
v-show="showSmallCallWindow" v-show="showSmallCallWindow"
class="flex items-center justify-between gap-3 bg-gray-900 text-base text-gray-300 -ml-3 mr-2 px-2 py-[7px] rounded-lg cursor-pointer select-none" class="flex items-center justify-between gap-3 bg-gray-900 text-base text-gray-300 ml-2 px-2 py-[7px] rounded-lg cursor-pointer select-none"
@click="toggleCallWindow" @click="toggleCallWindow"
> >
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">

View File

@ -1,12 +1,18 @@
<template> <template>
<svg <svg
xmlns="http://www.w3.org/2000/svg"
width="16" width="16"
height="16" height="16"
viewBox="0 0 16 16" viewBox="0 0 16 16"
fill="none" fill="none"
xmlns="http://www.w3.org/2000/svg"
> >
<rect width="16" height="16" rx="4.5" class="fill-current currentColor" /> <circle
<circle cx="8" cy="8" r="3" fill="white" /> cx="8"
cy="8"
r="4.5"
fill="white"
stroke="currentColor"
stroke-width="3"
/>
</svg> </svg>
</template> </template>

View File

@ -1,6 +1,6 @@
<template> <template>
<Teleport to="#app-header" v-if="showHeader"> <Teleport to="#app-header" v-if="showHeader">
<header class="flex justify-between items-center px-5 py-3"> <header class="flex justify-between items-center pl-5 py-2.5 h-12">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<slot name="left-header" /> <slot name="left-header" />
</div> </div>

View File

@ -3,7 +3,7 @@
<div class="flex flex-col overflow-y-hidden w-max min-w-full"> <div class="flex flex-col overflow-y-hidden w-max min-w-full">
<div <div
id="list-header" id="list-header"
class="flex space-x-4 items-center px-5 py-2 border-b" class="flex space-x-4 items-center mx-5 mb-2 p-2 rounded bg-gray-100"
> >
<Checkbox <Checkbox
class="duration-300 cursor-pointer" class="duration-300 cursor-pointer"
@ -13,7 +13,7 @@
<div <div
v-for="column in columns" v-for="column in columns"
:key="column" :key="column"
class="text-sm text-gray-600" class="text-base text-gray-600"
:class="[column.size, column.align]" :class="[column.size, column.align]"
> >
{{ column.label }} {{ column.label }}
@ -21,77 +21,81 @@
</div> </div>
<div id="list-rows" class="h-full overflow-y-auto"> <div id="list-rows" class="h-full overflow-y-auto">
<router-link <router-link
v-for="row in rows" v-for="(row, i) in rows"
:key="row[rowKey]" :key="row[rowKey]"
:to="$router.currentRoute.value.path + '/' + row[rowKey]" :to="$router.currentRoute.value.path + '/' + row[rowKey]"
class="flex space-x-4 items-center mx-2 px-3 py-2 border-b cursor-pointer transition-all duration-300 ease-in-out" class="flex flex-col mx-5 cursor-pointer transition-all duration-300 ease-in-out"
:class="
selections.has(row[rowKey])
? 'bg-gray-100 hover:bg-gray-200'
: 'hover:bg-gray-50'
"
> >
<Checkbox
:modelValue="selections.has(row[rowKey])"
@click.stop="toggleRow(row[rowKey])"
class="duration-300 cursor-pointer"
/>
<div <div
v-for="column in columns" class="flex space-x-4 items-center px-2 py-2.5 rounded"
:key="column.key" :class="
:class="[column.size, column.align]" selections.has(row[rowKey])
? 'bg-gray-100 hover:bg-gray-200'
: 'hover:bg-gray-50'
"
> >
<ListRowItem <Checkbox
:value="getValue(row[column.key]).label" :modelValue="selections.has(row[rowKey])"
:type="column.type" @click.stop="toggleRow(row[rowKey])"
:align="column.align" class="duration-300 cursor-pointer"
/>
<div
v-for="column in columns"
:key="column.key"
:class="[column.size, column.align]"
> >
<template #prefix> <ListRowItem
<div v-if="column.type === 'indicator'"> :value="getValue(row[column.key]).label"
<IndicatorIcon :class="getValue(row[column.key]).color" /> :type="column.type"
</div> :align="column.align"
<div v-else-if="column.type === 'avatar'"> >
<Avatar <template #prefix>
v-if="getValue(row[column.key]).label" <div v-if="column.type === 'indicator'">
class="flex items-center" <IndicatorIcon :class="getValue(row[column.key]).color" />
:image="getValue(row[column.key]).image" </div>
:label="getValue(row[column.key]).image_label" <div v-else-if="column.type === 'avatar'">
<Avatar
v-if="getValue(row[column.key]).label"
class="flex items-center"
:image="getValue(row[column.key]).image"
:label="getValue(row[column.key]).image_label"
size="sm"
/>
</div>
<div v-else-if="column.type === 'logo'">
<Avatar
v-if="getValue(row[column.key]).label"
class="flex items-center"
:image="getValue(row[column.key]).logo"
:label="getValue(row[column.key]).image_label"
size="sm"
/>
</div>
<div v-else-if="column.type === 'icon'">
<FeatherIcon
:name="getValue(row[column.key]).icon"
class="h-3 w-3"
/>
</div>
<div v-else-if="column.type === 'phone'">
<PhoneIcon class="h-4 w-4" />
</div>
</template>
<div v-if="column.type === 'badge'">
<Badge
:variant="'subtle'"
:theme="row[column.key].color"
size="md" size="md"
:label="row[column.key].label"
/> />
</div> </div>
<div v-else-if="column.type === 'logo'"> </ListRowItem>
<Avatar </div>
v-if="getValue(row[column.key]).label"
class="flex items-center"
:image="getValue(row[column.key]).logo"
:label="getValue(row[column.key]).image_label"
size="md"
shape="square"
/>
</div>
<div v-else-if="column.type === 'icon'">
<FeatherIcon
:name="getValue(row[column.key]).icon"
class="h-3 w-3"
/>
</div>
<div v-else-if="column.type === 'email'">
<FeatherIcon name="mail" class="h-3 w-3" />
</div>
<div v-else-if="column.type === 'phone'">
<FeatherIcon name="phone" class="h-3 w-3" />
</div>
</template>
<div v-if="column.type === 'badge'">
<Badge
:variant="'subtle'"
:theme="row[column.key].color"
size="md"
:label="row[column.key].label"
/>
</div>
</ListRowItem>
</div> </div>
<div
v-if="i < rows.length - 1"
class="mx-2 h-px border-t border-gray-200"
/>
</router-link> </router-link>
</div> </div>
<transition <transition
@ -139,6 +143,7 @@
</template> </template>
<script setup> <script setup>
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue' import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
import ListRowItem from '@/components/ListRowItem.vue' import ListRowItem from '@/components/ListRowItem.vue'
import { Checkbox, Avatar, Badge, FeatherIcon } from 'frappe-ui' import { Checkbox, Avatar, Badge, FeatherIcon } from 'frappe-ui'
import { reactive, computed } from 'vue' import { reactive, computed } from 'vue'

View File

@ -4,7 +4,7 @@
<Breadcrumbs :items="[{ label: list.title }]" /> <Breadcrumbs :items="[{ label: list.title }]" />
</template> </template>
</LayoutHeader> </LayoutHeader>
<div class="flex justify-between items-center px-5 pb-2.5 border-b"> <div class="flex justify-between items-center px-5 pt-3 pb-4">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Button label="Sort"> <Button label="Sort">
<template #prefix><SortIcon class="h-4" /></template> <template #prefix><SortIcon class="h-4" /></template>

View File

@ -9,7 +9,7 @@
</Button> </Button>
</template> </template>
</LayoutHeader> </LayoutHeader>
<div class="flex justify-between items-center px-5 pb-2.5 border-b"> <div class="flex justify-between items-center px-5 pt-3 pb-4">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Dropdown :options="viewsDropdownOptions"> <Dropdown :options="viewsDropdownOptions">
<template #default="{ open }"> <template #default="{ open }">

View File

@ -9,7 +9,7 @@
</Button> </Button>
</template> </template>
</LayoutHeader> </LayoutHeader>
<div class="flex justify-between items-center px-5 pb-2.5 border-b"> <div class="flex justify-between items-center px-5 pt-3 pb-4">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Dropdown :options="viewsDropdownOptions"> <Dropdown :options="viewsDropdownOptions">
<template #default="{ open }"> <template #default="{ open }">

View File

@ -9,7 +9,7 @@
</Button> </Button>
</template> </template>
</LayoutHeader> </LayoutHeader>
<div class="flex justify-between items-center px-5 pb-2.5 border-b"> <div class="flex justify-between items-center px-5 pt-3 pb-4">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Dropdown :options="viewsDropdownOptions"> <Dropdown :options="viewsDropdownOptions">
<template #default="{ open }"> <template #default="{ open }">
@ -159,7 +159,7 @@ const columns = [
label: 'Status', label: 'Status',
key: 'status', key: 'status',
type: 'indicator', type: 'indicator',
size: 'w-32', size: 'w-28',
}, },
{ {
label: 'Email', label: 'Email',