mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
update package card styling (#411)
This commit is contained in:
parent
81745c2084
commit
d9570e4b13
5 changed files with 125 additions and 57 deletions
|
@ -35,28 +35,29 @@
|
|||
</script>
|
||||
|
||||
<div class="dropdown z-10" use:clickOutside on:click_outside={handleClickOutside}>
|
||||
<PackageStateButton {buttonSize} {pkg} onClick={toggleOpen} />
|
||||
<div class="version-list" class:visible={isOpened}>
|
||||
{#each availableVersions as version, idx}
|
||||
{#if idx !== 0}<hr class="divider" />{/if}
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="version-item flex items-center justify-start gap-x-1 text-xs"
|
||||
class:installable-version={!isInstalled(version)}
|
||||
on:click={() => handleClick(version)}
|
||||
>
|
||||
<div class:installed-text={isInstalled(version)}>v{version}</div>
|
||||
{#if idx === 0}
|
||||
<div class="latest-version">(latest)</div>
|
||||
{/if}
|
||||
{#if isInstalled(version)}
|
||||
<div class="flex grow justify-end">
|
||||
<i class="installed-text icon-check-circle flex" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
<PackageStateButton {buttonSize} {pkg} onClick={toggleOpen}>
|
||||
<div class="version-list" class:visible={isOpened}>
|
||||
{#each availableVersions as version, idx}
|
||||
{#if idx !== 0}<hr class="divider" />{/if}
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="version-item flex items-center justify-start gap-x-1 text-xs"
|
||||
class:installable-version={!isInstalled(version)}
|
||||
on:click={() => handleClick(version)}
|
||||
>
|
||||
<div class:installed-text={isInstalled(version)}>v{version}</div>
|
||||
{#if idx === 0}
|
||||
<div class="latest-version">(latest)</div>
|
||||
{/if}
|
||||
{#if isInstalled(version)}
|
||||
<div class="flex grow justify-end">
|
||||
<i class="installed-text icon-check-circle flex" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</PackageStateButton>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
@ -65,6 +66,7 @@
|
|||
position: absolute;
|
||||
margin-top: 6px;
|
||||
width: 100%;
|
||||
color: white;
|
||||
background-color: #1a1a1a;
|
||||
border: 0.5px solid #949494;
|
||||
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5);
|
||||
|
@ -94,7 +96,6 @@
|
|||
position: relative;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
min-width: 130px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
|
|
|
@ -24,24 +24,66 @@
|
|||
</script>
|
||||
|
||||
<Button
|
||||
class={`w-full border text-xs text-white ${buttonSize === "small" ? "h-8" : "h-10"}`}
|
||||
class={`w-full border p-0 text-xs text-white ${buttonSize === "small" ? "h-8" : "h-10"}`}
|
||||
type="plain"
|
||||
color={getColor(pkg.state)}
|
||||
{onClick}
|
||||
>
|
||||
{#if pkg.state === PackageStates.INSTALLED}
|
||||
<div class="flex items-center justify-center">
|
||||
<i class="icon-check-circle mr-2 flex" />
|
||||
<span>{ctaLabel}</span>
|
||||
<div class="version-button">
|
||||
<div class="flex h-full flex-col justify-center p-2">
|
||||
{#if pkg.state === PackageStates.INSTALLED}
|
||||
<div class="flex items-center justify-center">
|
||||
<i class="icon-check-circle mr-2 flex" />
|
||||
<div>{ctaLabel}</div>
|
||||
</div>
|
||||
{:else if pkg.state === PackageStates.AVAILABLE}
|
||||
<div class="flex items-center justify-between gap-x-2">
|
||||
<div class="flex items-center gap-x-2">
|
||||
<div>{ctaLabel}</div>
|
||||
<div class="version-label install">{pkg.version}</div>
|
||||
</div>
|
||||
<i class="icon-downward-arrow flex" />
|
||||
</div>
|
||||
{:else if pkg.state === PackageStates.NEEDS_UPDATE}
|
||||
<div class="flex items-center justify-center gap-x-2">
|
||||
<div>{ctaLabel}</div>
|
||||
<div class="version-label update">{pkg.version}</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex items-center justify-center">
|
||||
{ctaLabel}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if pkg.state === PackageStates.AVAILABLE || pkg.state === PackageStates.INSTALLING}
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="ml-1">{ctaLabel}</span>
|
||||
<i class="icon-downward-arrow mr-1 flex" />
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex items-center justify-center">
|
||||
{ctaLabel}
|
||||
</div>
|
||||
{/if}
|
||||
<!-- This slot holds the drop down menu and it inside of the button so that the
|
||||
hover effect remain on the button while the user is hovering the dropdown items-->
|
||||
<slot />
|
||||
</div>
|
||||
</Button>
|
||||
|
||||
<style>
|
||||
.version-label {
|
||||
font-size: 10px;
|
||||
line-height: 12px;
|
||||
padding: 0 4px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.install {
|
||||
background-color: #dcb8ff;
|
||||
color: #8000ff;
|
||||
}
|
||||
|
||||
.update {
|
||||
background-color: #04957a;
|
||||
color: #00ffd0;
|
||||
}
|
||||
|
||||
.version-button:hover .install {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.version-button:hover .update {
|
||||
background-color: #1a1a1a;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
};
|
||||
</script>
|
||||
|
||||
<section class="package-card relative h-auto border border-gray">
|
||||
<section class="package-card border-gray relative h-auto border">
|
||||
<a href={link}>
|
||||
<figure class="relative">
|
||||
<ImgLoader
|
||||
|
@ -32,22 +32,13 @@
|
|||
<h4 class="text-sm font-light">• {pkg.maintainer}</h4>
|
||||
{/if}
|
||||
{#if pkg.desc}
|
||||
<p class="text-xs font-thin line-clamp-2">{pkg.desc}</p>
|
||||
<p class="line-clamp-2 text-xs font-thin">{pkg.desc}</p>
|
||||
{/if}
|
||||
</article>
|
||||
</a>
|
||||
<footer class="absolute bottom-0 left-0 flex w-full items-stretch justify-between gap-2 p-2">
|
||||
<div class="m-2 flex w-full items-center justify-between">
|
||||
<div class="flex-1">
|
||||
<div class="pk-version flex items-center whitespace-nowrap text-xs font-extralight">
|
||||
<i class="icon-versions-available mr-1 flex" />
|
||||
{availableVersions.length} {availableVersions.length === 1 ? "version" : "versions"}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-1"><!-- Spacer --></div>
|
||||
<div class="flex-[2_2_0%]">
|
||||
<InstallButton {pkg} {availableVersions} onClick={onClickCTA} />
|
||||
</div>
|
||||
<footer class="absolute bottom-0 left-0 flex w-full p-3">
|
||||
<div class="install-button">
|
||||
<InstallButton {pkg} {availableVersions} onClick={onClickCTA} />
|
||||
</div>
|
||||
</footer>
|
||||
{#if progessLoading > 0 && progessLoading < 100}
|
||||
|
@ -90,4 +81,20 @@
|
|||
.card-thumb-label p {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.install-button {
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 650px) {
|
||||
.install-button {
|
||||
min-width: 60%;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1000px) {
|
||||
.install-button {
|
||||
min-width: 50%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -81,12 +81,12 @@
|
|||
};
|
||||
</script>
|
||||
|
||||
<div class="h-full w-full relative">
|
||||
<div class="relative h-full w-full">
|
||||
<ul class="flex flex-wrap bg-black" use:watchResize={onResize} on:scroll={onScroll}>
|
||||
{#if packages.length > 0}
|
||||
{#each packages as pkg, index}
|
||||
{#if index < limit}
|
||||
<div class="w-1/3 p-1 z-1" class:animate-puls={pkg.state === PackageStates.INSTALLING}>
|
||||
<div class="card z-1 p-1" class:animate-puls={pkg.state === PackageStates.INSTALLING}>
|
||||
<Package
|
||||
tab={packageFilter}
|
||||
{pkg}
|
||||
|
@ -97,8 +97,8 @@
|
|||
{/each}
|
||||
{:else}
|
||||
{#each Array(9) as _}
|
||||
<section class="w-1/3 p-1 h-{238}">
|
||||
<div class="border-gray border w-full h-full">
|
||||
<section class="card p-1 h-{238}">
|
||||
<div class="border-gray h-full w-full border">
|
||||
<Preloader />
|
||||
</div>
|
||||
</section>
|
||||
|
@ -138,4 +138,20 @@
|
|||
::-webkit-scrollbar-thumb:hover {
|
||||
background: white;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 650px) {
|
||||
.card {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1000px) {
|
||||
.card {
|
||||
width: 33.333333%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
<style>
|
||||
.button-container {
|
||||
position: relative;
|
||||
min-width: 100px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* pseudo element for hover effect - width will transition on hover */
|
||||
|
@ -49,7 +52,6 @@
|
|||
|
||||
button {
|
||||
z-index: 0;
|
||||
min-width: 100px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue