Standardise icons across groups and users
This commit is contained in:
parent
73b563ef19
commit
2d4ae38a02
|
@ -0,0 +1,58 @@
|
||||||
|
<script>
|
||||||
|
import Icon from "./Icon.svelte"
|
||||||
|
|
||||||
|
export let icon
|
||||||
|
export let background
|
||||||
|
export let color
|
||||||
|
export let size = "M"
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="icon size--{size}"
|
||||||
|
style="background: {background || `transparent`};"
|
||||||
|
class:filled={!!background}
|
||||||
|
>
|
||||||
|
<Icon name={icon} color={background ? "white" : color} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.icon {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.icon :global(.spectrum-Icon) {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
.icon.filled :global(.spectrum-Icon) {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
.icon.size--S {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
}
|
||||||
|
.icon.size--S :global(.spectrum-Icon) {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
.icon.size--S.filled :global(.spectrum-Icon) {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
.icon.size--L {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
.icon.size--L :global(.spectrum-Icon) {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
.icon.size--L.filled :global(.spectrum-Icon) {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,11 +1,12 @@
|
||||||
<script>
|
<script>
|
||||||
import Body from "../Typography/Body.svelte"
|
import Body from "../Typography/Body.svelte"
|
||||||
import Icon from "../Icon/Icon.svelte"
|
import IconAvatar from "../Icon/IconAvatar.svelte"
|
||||||
import Label from "../Label/Label.svelte"
|
import Label from "../Label/Label.svelte"
|
||||||
import Avatar from "../Avatar/Avatar.svelte"
|
import Avatar from "../Avatar/Avatar.svelte"
|
||||||
|
|
||||||
export let icon = null
|
export let icon = null
|
||||||
export let iconBackground = null
|
export let iconBackground = null
|
||||||
|
export let iconColor = null
|
||||||
export let avatar = false
|
export let avatar = false
|
||||||
export let title = null
|
export let title = null
|
||||||
export let subtitle = null
|
export let subtitle = null
|
||||||
|
@ -17,9 +18,7 @@
|
||||||
<div class="list-item" class:hoverable on:click>
|
<div class="list-item" class:hoverable on:click>
|
||||||
<div class="left">
|
<div class="left">
|
||||||
{#if icon}
|
{#if icon}
|
||||||
<div class="icon" style="background: {iconBackground || `transparent`};">
|
<IconAvatar {icon} color={iconColor} background={iconBackground} />
|
||||||
<Icon name={icon} size="S" color={iconBackground ? "white" : null} />
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if avatar}
|
{#if avatar}
|
||||||
<Avatar {initials} />
|
<Avatar {initials} />
|
||||||
|
@ -88,11 +87,4 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
.icon {
|
|
||||||
width: var(--spectrum-alias-avatar-size-400);
|
|
||||||
height: var(--spectrum-alias-avatar-size-400);
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -64,6 +64,9 @@
|
||||||
<style>
|
<style>
|
||||||
.spectrum-Popover {
|
.spectrum-Popover {
|
||||||
min-width: var(--spectrum-global-dimension-size-2000) !important;
|
min-width: var(--spectrum-global-dimension-size-2000) !important;
|
||||||
|
border-color: var(--spectrum-global-color-gray-200);
|
||||||
|
box-shadow: 0 8px 16px 2px rgba(0, 0, 0, 0.25);
|
||||||
|
filter: none;
|
||||||
}
|
}
|
||||||
.spectrum-Popover.is-open.spectrum-Popover--withTip {
|
.spectrum-Popover.is-open.spectrum-Popover--withTip {
|
||||||
margin-top: var(--spacing-xs);
|
margin-top: var(--spacing-xs);
|
||||||
|
|
|
@ -20,6 +20,7 @@ export { default as Button } from "./Button/Button.svelte"
|
||||||
export { default as ButtonGroup } from "./ButtonGroup/ButtonGroup.svelte"
|
export { default as ButtonGroup } from "./ButtonGroup/ButtonGroup.svelte"
|
||||||
export { default as ClearButton } from "./ClearButton/ClearButton.svelte"
|
export { default as ClearButton } from "./ClearButton/ClearButton.svelte"
|
||||||
export { default as Icon, directions } from "./Icon/Icon.svelte"
|
export { default as Icon, directions } from "./Icon/Icon.svelte"
|
||||||
|
export { default as IconAvatar } from "./Icon/IconAvatar.svelte"
|
||||||
export { default as Toggle } from "./Form/Toggle.svelte"
|
export { default as Toggle } from "./Form/Toggle.svelte"
|
||||||
export { default as RadioGroup } from "./Form/RadioGroup.svelte"
|
export { default as RadioGroup } from "./Form/RadioGroup.svelte"
|
||||||
export { default as Checkbox } from "./Form/Checkbox.svelte"
|
export { default as Checkbox } from "./Form/Checkbox.svelte"
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
export let selected
|
export let selected
|
||||||
export let list = []
|
export let list = []
|
||||||
export let labelKey
|
export let labelKey
|
||||||
|
export let iconComponent = null
|
||||||
|
export let extractIconProps = x => x
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
@ -42,7 +44,6 @@
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<Search placeholder="Search" bind:value={searchTerm} />
|
<Search placeholder="Search" bind:value={searchTerm} />
|
||||||
</div>
|
</div>
|
||||||
<Divider noMargin />
|
|
||||||
<div class="items">
|
<div class="items">
|
||||||
{#each sortedList as item}
|
{#each sortedList as item}
|
||||||
<div
|
<div
|
||||||
|
@ -51,6 +52,12 @@
|
||||||
}}
|
}}
|
||||||
class="item"
|
class="item"
|
||||||
>
|
>
|
||||||
|
{#if iconComponent}
|
||||||
|
<svelte:component
|
||||||
|
this={iconComponent}
|
||||||
|
{...extractIconProps(item)}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
<div class="text">
|
<div class="text">
|
||||||
{item[labelKey]}
|
{item[labelKey]}
|
||||||
</div>
|
</div>
|
||||||
|
@ -86,14 +93,14 @@
|
||||||
margin-top: -8px;
|
margin-top: -8px;
|
||||||
}
|
}
|
||||||
.item {
|
.item {
|
||||||
align-items: end;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: var(--spacing-s) var(--spacing-l);
|
padding: var(--spacing-s) var(--spacing-l);
|
||||||
background: var(--spectrum-global-color-gray-50);
|
background: var(--spectrum-global-color-gray-50);
|
||||||
transition: background 130ms ease-out;
|
transition: background 130ms ease-out;
|
||||||
gap: var(--spacing-xl);
|
gap: var(--spacing-m);
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.item:hover {
|
.item:hover {
|
||||||
background: var(--spectrum-global-color-gray-100);
|
background: var(--spectrum-global-color-gray-100);
|
||||||
|
|
|
@ -112,7 +112,7 @@
|
||||||
<Layout noPadding gap="M">
|
<Layout noPadding gap="M">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<GroupIcon {group} />
|
<GroupIcon {group} size="L" />
|
||||||
<div class="text-padding">
|
<div class="text-padding">
|
||||||
<Heading>{group?.name}</Heading>
|
<Heading>{group?.name}</Heading>
|
||||||
</div>
|
</div>
|
||||||
|
@ -158,7 +158,6 @@
|
||||||
{#each group.users as user}
|
{#each group.users as user}
|
||||||
<ListItem
|
<ListItem
|
||||||
title={user.email}
|
title={user.email}
|
||||||
avatar
|
|
||||||
on:click={() => $goto(`../users/${user._id}`)}
|
on:click={() => $goto(`../users/${user._id}`)}
|
||||||
hoverable
|
hoverable
|
||||||
>
|
>
|
||||||
|
@ -188,7 +187,7 @@
|
||||||
<ListItem
|
<ListItem
|
||||||
title={app.name}
|
title={app.name}
|
||||||
icon={app?.icon?.name || "Apps"}
|
icon={app?.icon?.name || "Apps"}
|
||||||
iconBackground={app?.icon?.color || ""}
|
iconColor={app?.icon?.color || ""}
|
||||||
on:click={() => $goto(`../../overview/${app.devId}`)}
|
on:click={() => $goto(`../../overview/${app.devId}`)}
|
||||||
hoverable
|
hoverable
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,20 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { Icon } from "@budibase/bbui"
|
import { IconAvatar } from "@budibase/bbui"
|
||||||
|
|
||||||
export let group
|
export let group
|
||||||
|
export let size = "M"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div style="background: {group?.color};" class="circle">
|
<IconAvatar icon={group?.icon} background={group?.color} {size} />
|
||||||
<Icon size="S" name={group?.icon} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.circle {
|
|
||||||
border-radius: 50%;
|
|
||||||
height: 30px;
|
|
||||||
width: 30px;
|
|
||||||
color: white;
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
import { RoleUtils } from "@budibase/frontend-core"
|
import { RoleUtils } from "@budibase/frontend-core"
|
||||||
import UserGroupPicker from "components/settings/UserGroupPicker.svelte"
|
import UserGroupPicker from "components/settings/UserGroupPicker.svelte"
|
||||||
import DeleteUserModal from "./_components/DeleteUserModal.svelte"
|
import DeleteUserModal from "./_components/DeleteUserModal.svelte"
|
||||||
|
import GroupIcon from "../groups/_components/GroupIcon.svelte"
|
||||||
|
|
||||||
export let userId
|
export let userId
|
||||||
|
|
||||||
|
@ -207,7 +208,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if userId !== $auth.user._id}
|
{#if userId !== $auth.user?._id}
|
||||||
<div>
|
<div>
|
||||||
<ActionMenu align="right">
|
<ActionMenu align="right">
|
||||||
<span slot="control">
|
<span slot="control">
|
||||||
|
@ -277,6 +278,8 @@
|
||||||
selected={user.userGroups}
|
selected={user.userGroups}
|
||||||
on:select={e => addGroup(e.detail)}
|
on:select={e => addGroup(e.detail)}
|
||||||
on:deselect={e => removeGroup(e.detail)}
|
on:deselect={e => removeGroup(e.detail)}
|
||||||
|
iconComponent={GroupIcon}
|
||||||
|
extractIconProps={item => ({ group: item, size: "S" })}
|
||||||
/>
|
/>
|
||||||
</Popover>
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
|
@ -320,7 +323,7 @@
|
||||||
{#each availableApps as app}
|
{#each availableApps as app}
|
||||||
<ListItem
|
<ListItem
|
||||||
title={app.name}
|
title={app.name}
|
||||||
iconBackground={app?.icon?.color || ""}
|
iconColor={app?.icon?.color}
|
||||||
icon={app?.icon?.name || "Apps"}
|
icon={app?.icon?.name || "Apps"}
|
||||||
hoverable
|
hoverable
|
||||||
on:click={() => $goto(`../../overview/${app.devId}`)}
|
on:click={() => $goto(`../../overview/${app.devId}`)}
|
||||||
|
|
Loading…
Reference in New Issue