Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
refactor: various enhancements, redesigned UI/UX
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-mader authored Sep 5, 2023
1 parent 37323ee commit bc883bb
Show file tree
Hide file tree
Showing 35 changed files with 1,091 additions and 635 deletions.
4 changes: 3 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const config: StorybookConfig = {
{
name: '@storybook/addon-styling',
options: {
postCss: true
// postCss: {
// implementation: require.resolve('postcss')
// }
}
},
'storybook-tailwind-dark-mode'
Expand Down
1 change: 1 addition & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<link href="/tailwind.css" rel="stylesheet" />
<link href="/satoshi.css" rel="stylesheet" />
<link href="/inter.css" rel="stylesheet" />
<link href="/flag-icons.min.css" rel="stylesheet" />

<script>
Expand Down
138 changes: 68 additions & 70 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impierce/ui-components",
"version": "0.0.15-alpha",
"version": "0.1.1",
"repository": {
"type": "git",
"url": "https://github.com/Impierce/ui-components.git"
Expand All @@ -20,9 +20,9 @@
"format": "prettier --plugin-search-dir . --write .",
"storybook": "concurrently 'npm:watch:*' ",
"watch:storybook": "storybook dev -p 6006 --no-open",
"watch:tailwind": "npx tailwindcss -i ./src/app.postcss -o ./static/tailwind.css --watch",
"watch:tailwind": "npx tailwindcss -i ./src/app.css -o ./static/tailwind.css --watch",
"build-storybook": "npm run build:tailwind && storybook build",
"build:tailwind": "npx tailwindcss -i ./src/app.postcss -o ./static/tailwind.css -o ./dist/main.css"
"build:tailwind": "npx tailwindcss -i ./src/app.css -o ./static/tailwind.css -o ./dist/main.css"
},
"exports": {
".": {
Expand All @@ -40,7 +40,7 @@
"svelte": "^3.57.0"
},
"dependencies": {
"@melt-ui/svelte": "^0.24.0",
"@melt-ui/svelte": "^0.39.1",
"class-variance-authority": "^0.6.0",
"clsx": "^1.2.1",
"flag-icons": "^6.7.0",
Expand All @@ -55,7 +55,8 @@
"devDependencies": {
"@iconify-json/flag": "^1.1.32",
"@iconify-json/lucide": "^1.1.109",
"@melt-ui/pp": "^0.0.6",
"@iconify-json/ph": "^1.1.6",
"@melt-ui/pp": "^0.1.2",
"@playwright/test": "^1.28.1",
"@storybook/addon-essentials": "~7.0.27",
"@storybook/addon-interactions": "~7.0.27",
Expand Down
15 changes: 15 additions & 0 deletions src/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
:root {
--background: 0 0% 96%; /* neutral-100, #f5f5f5 */
--foreground: 0 0% 100%; /* white, #ffffff */

--primary: 180 42% 66%; /* #83cccc */

/**
* DARK MODE
*/
--dark-background: 212 55% 18%; /* lighter, #152D49 */
--dark-foreground: 216 53% 16%; /* darker, #13243D */
}
}
10 changes: 5 additions & 5 deletions src/app.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 47.4% 11.2%;
--background: 0 0% 96%; /* neutral-100, #f5f5f5 */
--foreground: 0 0% 100%; /* white, #ffffff */

--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
Expand All @@ -19,7 +19,7 @@
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;

--primary: 263 70% 50%; /* Violet 700, #6d28d9 */
--primary: 180 42% 66%; /* #83cccc */
--primary-foreground: 210 40% 98%;

--secondary: 210 40% 96.1%;
Expand All @@ -37,8 +37,8 @@
}

.dark {
--background: 224 71% 4%;
--foreground: 213 31% 91%;
--background: 212 55% 18%; /* lighter, #152D49 */
--foreground: 216 53% 16%; /* darker, #13243D */

--muted: 223 47% 11%;
--muted-foreground: 215.4 16.3% 56.9%;
Expand Down
26 changes: 26 additions & 0 deletions src/lib/atoms/AppIcon.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!-- <div
style="width: 1024px; height: 1024px; padding-top: 161px; padding-bottom: 172px; padding-left: 210px; padding-right: 230px; background: #5CC7C7; justify-content: flex-start; align-items: center; display: inline-flex"
> -->
<div
class="relative inline-flex h-[1024px] w-[1024px] items-center justify-start bg-[#5CC7C7] pl-[210px] pr-[230px] pt-[161px] pb-[172px]"
>
<div
class="font-sm absolute top-[84px] -right-[512px] z-10 rotate-45 bg-rose-500 px-[512px] font-mono text-[144px] font-semibold text-white"
>
BETA
</div>
<div style="width: 584px; height: 691px; background: #5CC7C7">
<svg
width="584"
height="691"
viewBox="0 0 584 691"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M310.383 5.48174C352.354 -5.5979 394.526 0.139778 433.874 22.4969C525.08 74.1359 530.326 193.242 447.797 333.32C422.574 376.254 388.877 430.069 351.547 466.87C288.793 528.797 237.54 520.289 205.658 502.285C159.046 475.971 144.518 432.444 162.275 372.693C175.391 328.968 209.29 276.537 259.736 190.868L327.131 229.053C280.923 307.798 247.629 357.854 236.934 394.061C227.249 426.31 235.32 430.861 244.4 436.005C278.905 455.394 344.283 356.073 380.2 294.937C409.055 245.87 426.004 197.99 427.619 160.003C430.04 108.364 403.405 93.3274 394.728 88.3812C367.488 72.9488 340.247 72.3552 310.989 86.2048C270.632 105.396 227.451 152.683 186.085 222.92C141.491 298.696 92.8619 385.157 80.755 454.999C69.6569 518.904 89.2298 560.057 146.536 592.505C212.721 629.899 271.843 619.808 338.229 559.661C400.782 502.878 461.518 423.145 516.605 329.363L584 367.549C525.685 466.474 461.518 551.748 391.096 615.653C299.487 698.751 204.044 713.194 107.592 658.587C22.2381 610.311 -12.6703 537.502 4.07767 441.94C18.4042 359.832 70.6658 266.051 118.69 184.537C168.53 100.054 221.801 43.6669 276.887 17.3528C287.985 12.6044 299.083 8.4495 310.383 5.48174Z"
fill="white"
/>
</svg>
</div>
</div>
40 changes: 25 additions & 15 deletions src/lib/atoms/BottomNavigationItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,29 @@
export let label: string;
</script>

<button
class="rounded-full py-2 px-6 hover:bg-slate-100 dark:hover:bg-slate-700"
on:click={() => dispatch('click')}
>
<div class="flex h-12 w-10 flex-col items-center justify-center">
<!-- Currently, there is no better way of applying conditional Tailwind classes to a named slot inside a component. -->
<slot name="icon" />
<div
class={`pt-1 text-xs ${
active ? 'text-violet-700 dark:text-violet-600' : 'text-slate-500 dark:text-slate-400'
}`}
>
{label}
<div class="flex flex-col items-center">
<!-- Indicator -->
{#if active}
<div class="h-[4px] w-full rounded-full bg-primary" />
{/if}

<!-- Button -->
<button
class={`rounded-full px-6 active:bg-background dark:active:bg-background-dark ${
active ? 'pt-2' : 'pt-3'
}`}
on:click={() => dispatch('click')}
>
<div class="flex h-12 w-10 flex-col items-center justify-center">
<!-- Currently, there is no better way of applying conditional Tailwind classes to a named slot inside a component. -->
<slot name="icon" />
<div
class={`text-[12px]/[20px] pt-[6px] ${
active ? 'text-slate-800 dark:text-primary' : 'text-slate-300 dark:text-white'
}`}
>
{label}
</div>
</div>
</div>
</button>
</button>
</div>
8 changes: 5 additions & 3 deletions src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import SearchInput from './atoms/Input.svelte';
// Molecules
import ActivityTabs from './molecules/ActivityTabs.svelte';
import TopNavigation from './molecules/TopNavigation.svelte';
import BottomNavigation from './molecules/BottomNavigation.svelte';
import BottomNavBar from './molecules/navigation/BottomNavBar.svelte';
import CredentialListEntry from './molecules/CredentialListEntry.svelte';
import BottomDrawer from './molecules/dialogs/BottomDrawer.svelte';

// Templates
import ActionTemplate from './templates/ActionTemplate.svelte';
Expand Down Expand Up @@ -48,10 +49,11 @@ export {
Checkbox,
ProgressBar,
TopNavigation,
BottomNavigation,
BottomNavBar,
CredentialListEntry,
ActionTemplate,
DetailsTemplate
DetailsTemplate,
BottomDrawer
};

export * from './components/ui/tabs';
Expand Down
100 changes: 59 additions & 41 deletions src/lib/melt-ui/Select.svelte
Original file line number Diff line number Diff line change
@@ -1,61 +1,79 @@
<script lang="ts">
import { createSelect } from '@melt-ui/svelte';
import Check from '~icons/lucide/check';
import ChevronDown from '~icons/lucide/chevron-down';
import { createSelect, melt } from '@melt-ui/svelte';
import { Check, ChevronDown } from 'lucide-svelte';
import { fly } from 'svelte/transition';
const { label, trigger, menu, option, isSelected, group, groupLabel } = createSelect();
const {
elements: { trigger, menu, option, group, groupLabel, label },
states: { valueLabel, open },
helpers: { isSelected }
} = createSelect({
forceVisible: true
});
const options = {
sweet: ['Caramel', 'Chocolate', 'Strawberry', 'Cookies & Cream'],
savory: ['Basil', 'Bacon', 'Rosemary', 'Balsamic Fig']
};
</script>

<button class="trigger" melt={$trigger} aria-label="Food">
{$label || 'Select an option'}
<ChevronDown />
</button>

<div class="menu" melt={$menu}>
{#each Object.entries(options) as [key, arr]}
<div melt={$group(key)}>
<div class="label" melt={$groupLabel(key)}>{key}</div>
{#each arr as item}
<div class="option" melt={$option({ value: item, label: item })}>
{#if $isSelected(item)}
<div class="check">
<Check />
<div class="flex flex-col gap-1">
<!-- svelte-ignore a11y-label-has-associated-control - $label contains the 'for' attribute -->
<label class="block" use:melt={$label}>Favorite Flavor</label>
<button
class="text-blue-700 flex h-10 min-w-[220px] items-center justify-between rounded-md bg-white
px-3 py-2 transition-opacity hover:opacity-90"
use:melt={$trigger}
aria-label="Food"
>
{$valueLabel || 'Select a flavor'}
<ChevronDown class="square-5" />
</button>
{#if $open}
<div
class="z-10 flex max-h-[360px] flex-col
overflow-y-auto rounded-md bg-white
p-1 focus:!ring-0"
use:melt={$menu}
transition:fly={{ duration: 100, y: -5 }}
>
{#each Object.entries(options) as [key, arr]}
<div use:melt={$group(key)}>
<div
class="py-1 pl-4 pr-4 font-semibold capitalize text-neutral-800"
use:melt={$groupLabel(key)}
>
{key}
</div>
{#each arr as item}
<div
class="focus:text-blue-700 data-[highlighted]:bg-blue-50 data-[selected]:bg-blue-100 data-[highlighted]:text-blue-900 data-[selected]:text-blue-900 relative cursor-pointer
rounded-md py-1
pl-8 pr-4
text-neutral-800 focus:z-10"
use:melt={$option({ value: item, label: item })}
>
{#if $isSelected(item)}
<div class="check">
<Check class="square-4" />
</div>
{/if}
{item}
</div>
{/if}
{item}
{/each}
</div>
{/each}
</div>
{/each}
{/if}
</div>

<style lang="postcss">
.label {
@apply py-1 pl-4 pr-4 font-semibold capitalize text-neutral-800;
}
.menu {
@apply z-10 flex max-h-[360px] flex-col overflow-y-auto;
@apply rounded-md bg-white p-1;
@apply ring-0 !important;
}
.option {
@apply relative cursor-pointer rounded-md py-1 pl-8 pr-4 text-neutral-800;
@apply focus:text-blue-700 focus:z-10;
@apply data-[highlighted]:bg-blue-50 data-[highlighted]:text-blue-900;
@apply data-[selected]:bg-blue-100 data-[selected]:text-blue-900;
}
.trigger {
@apply flex h-10 min-w-[220px] items-center justify-between rounded-md bg-white px-3;
@apply text-blue-700 py-2 transition-opacity hover:opacity-90;
}
.check {
@apply text-blue-500 absolute left-2 top-1/2 z-20;
position: absolute;
left: theme(spacing.2);
top: 50%;
z-index: theme(zIndex.20);
translate: 0 calc(-50% + 1px);
color: theme(colors.blue.500);
}
</style>
Loading

0 comments on commit bc883bb

Please sign in to comment.