Skip to content

Network themes #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 58 commits into from
Apr 25, 2025
Merged

Network themes #427

merged 58 commits into from
Apr 25, 2025

Conversation

deansallinen
Copy link
Contributor

Add support for per-network color themes and light/dark mode by implementing a role-based abstraction layer between palette and component

@deansallinen deansallinen marked this pull request as draft April 4, 2025 16:55
Copy link

cloudflare-workers-and-pages bot commented Apr 4, 2025

Deploying unicove-waxtestnet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 28620ba
Status: ✅  Deploy successful!
Preview URL: https://0bcc5e3d.unicove-waxtestnet.pages.dev
Branch Preview URL: https://network-themes.unicove-waxtestnet.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented Apr 4, 2025

Deploying unicove-telostestnet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 28620ba
Status: ✅  Deploy successful!
Preview URL: https://aa6b12fd.unicove-telostestnet.pages.dev
Branch Preview URL: https://network-themes.unicove-telostestnet.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented Apr 4, 2025

Deploying unicove-telos with  Cloudflare Pages  Cloudflare Pages

Latest commit: 28620ba
Status: ✅  Deploy successful!
Preview URL: https://b48c1cb5.unicove-telos.pages.dev
Branch Preview URL: https://network-themes.unicove-telos.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented Apr 4, 2025

Deploying unicove-wax with  Cloudflare Pages  Cloudflare Pages

Latest commit: 28620ba
Status: ✅  Deploy successful!
Preview URL: https://7b835908.unicove-wax.pages.dev
Branch Preview URL: https://network-themes.unicove-wax.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented Apr 4, 2025

Deploying unicove-jungle4 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 28620ba
Status: ✅  Deploy successful!
Preview URL: https://c3fb6a8c.unicove-jungle4.pages.dev
Branch Preview URL: https://network-themes.unicove-jungle4.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented Apr 4, 2025

Deploying unicove-kylin with  Cloudflare Pages  Cloudflare Pages

Latest commit: 28620ba
Status: ✅  Deploy successful!
Preview URL: https://4f4c2091.unicove-kylin.pages.dev
Branch Preview URL: https://network-themes.unicove-kylin.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented Apr 4, 2025

Deploying unicove-eos with  Cloudflare Pages  Cloudflare Pages

Latest commit: 34a3693
Status: ✅  Deploy successful!
Preview URL: https://5ab4e955.unicove-eos.pages.dev
Branch Preview URL: https://network-themes.unicove-eos.pages.dev

View logs

@deansallinen deansallinen linked an issue Apr 4, 2025 that may be closed by this pull request
@deansallinen deansallinen force-pushed the network-themes branch 8 times, most recently from 5ff2402 to 2c53aa4 Compare April 11, 2025 22:16
Copy link

cloudflare-workers-and-pages bot commented Apr 24, 2025

Deploying unicove-vaulta with  Cloudflare Pages  Cloudflare Pages

Latest commit: 28620ba
Status: ✅  Deploy successful!
Preview URL: https://1b17b21a.unicove-eos.pages.dev
Branch Preview URL: https://network-themes.unicove-eos.pages.dev

View logs

@deansallinen deansallinen marked this pull request as ready for review April 25, 2025 17:06
Comment on lines +168 to +190
[data-theme='eos'] {
--color-seed: rgb(248 187 113);
}

[data-theme='telos'] {
--color-seed: rgb(207 189 254);
}

[data-theme='jungle4'] {
--color-seed: #2e9e87;
}

[data-theme='vaulta'] {
--color-seed: #2e3bff;
}

[data-theme='wax'] {
--color-seed: rgb(255 183 123);
}

[data-theme='kylin'] {
--color-seed: rgb(255 180 168);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next steps would be to define these in the chain config if we can read .env in a css file somehow

src/app.css Outdated
Comment on lines 193 to 216
@media (prefers-color-scheme: light) {
/* [data-theme='eos'] { */
/* --color-seed: rgb(134 83 0); */
/* } */
/**/
/* [data-theme='jungle4'] { */
/* --color-seed: rgb(0 104 87); */
/* } */
/**/
/* [data-theme='vaulta'] { */
/* --color-seed: #2e3bff; */
/* } */
/**/
/* [data-theme='telos'] { */
/* --color-seed: rgb(101 85 143); */
/* } */
/**/
/* [data-theme='wax'] { */
/* --color-seed: rgb(136 81 29); */
/* } */
/**/
/* [data-theme='kylin'] { */
/* --color-seed: rgb(144 75 64); */
/* } */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to change. We'll need to recalculate the color values for the light theme from the chain branding color. Those will be different than the dark mode calculations.

@@ -1,5 +1,5 @@
<!doctype html>
<html lang="%paraglide.lang%" dir="%paraglide.textDirection%">
<html lang="%paraglide.lang%" dir="%paraglide.textDirection%" data-theme="%network%">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how we tell an element to use a specific theme.

@@ -161,18 +161,18 @@
</button>

{#if $open}
<div class="" use:melt={$portalled}>
<div data-theme={network} class="" use:melt={$portalled}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Portalled elements need a data attribute with the network theme set

Comment on lines +82 to +84
<div
class="state-layer group-active/button:group-hove/buttonr:opacity-16 pointer-events-none absolute inset-0 rounded-[inherit] bg-current opacity-0 transition-opacity group-hover/button:opacity-8 group-focus-visible/button:opacity-10 group-disabled/button:hidden"
></div>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buttons now use a dedicated layer to handle changes in state.

>
{/if}
</div>
<IconButton icon={Copy} onclick={copyToClipboard} {...props} />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New IconButton component is a generic component that can take any icon and turn it into a buton.

Comment on lines +32 to +39
{#if hint}
<!-- <span -->
<!-- in:fly={{ x: -20, easing: quartOut, duration: 100 }} -->
<!-- out:fade={{ easing: quadIn, duration: 200 }} -->
<!-- class="text-primary absolute inset-y-0 left-full translate-x-2 text-xs text-nowrap select-none" -->
<!-- >{m.common_copied_result()}</span -->
<!-- > -->
{/if}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabled the "Copied!" flyout for now. Need to find a way to achieve the same effect anywhere without affecting layout. Perhaps a portalled element like how melt-ui does tooltips.

Comment on lines +100 to +108
<details
bind:this={detailsElement}
class={cn('group token-balance-card bg-surface-container rounded-xl', className)}
open={open && _balance instanceof TokenBalance}
>
<summary
class="focus-visible:outline-solar-500 @container grid cursor-pointer grid-cols-[auto_1fr_auto] gap-3 rounded-xl p-5 select-none focus-visible:outline"
onclick={syncOpen}
>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using details/summary pattern here. See issue for more details.

<span class="text-red-500">
▼ {percentChangeString}% {timeframeString}
<span class="inline-flex gap-1.5 leading-none text-red-500">
<Triangle fill="currentColor" class="size-4 rotate-180" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an icon instead of the unicode character - we have better control over appearance this way

Comment on lines +128 to +156
<DL>
<DLRow title={` ${data.network.token.id.symbol.code || ''}/RAM (KB) `}>
<DD>
<AssetText variant="full" value={kbValueToken} />
</DD>
</DLRow>
<DLRow title={` ${market.network.currency.symbol.code}/RAM (KB) `}>
<DD>
<AssetText variant="full" value={kbValueFiat} />
</DD>
</DLRow>
<DLRow
title={m.common_labeled_unit_price({
unit: market.network.currency.symbol.code
})}
>
<DD>
<AssetText
variant="full"
value={calculateValue(ramCalculatorState.tokens, market.network.systemtoken.price)}
/>
</DD>
</DLRow>
<DLRow title={m.common_network_fees()}>
<DD>
<AssetText variant="full" value={ramCalculatorState.fee} />
</DD>
</DLRow>
</DL>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the component that best fits the data

<Button variant="secondary" href="/{network}/ram">{m.common_ram_market()}</Button>
</Stack>
<AccountBalance />
<SingleCard class="">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored the resources pages to use the SingleCard layout component

Comment on lines -88 to +95
<button
class="text-sky-500 hover:text-sky-400"
<Button
variant="tertiary"
onclick={() => {
manager.setMaxValue();
}}
type="button"
>{m.common_labeled_unit_available({ unit: '' })}:
<AssetText value={manager.stakable} />
</button>
</Button>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using correct component for the design requirements

@aaroncox aaroncox merged commit 472d7f3 into dev Apr 25, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add keyboard navigation to the select components
2 participants