* add pro badge to themer

* add isPro flag to palettes

* show based on currentUser.hasPro

* fix logged out user stuff

---------

Co-authored-by: Cory LaViska <cory@abeautifulsite.net>
This commit is contained in:
Konnor Rogers
2025-06-30 12:13:21 -04:00
committed by GitHub
parent 956dc9bdd9
commit e7f2962984
5 changed files with 78 additions and 17 deletions

2
package-lock.json generated
View File

@@ -13994,7 +13994,7 @@
}, },
"packages/webawesome-pro": { "packages/webawesome-pro": {
"name": "@shoelace-style/webawesome-pro", "name": "@shoelace-style/webawesome-pro",
"version": "3.0.0-alpha.13", "version": "3.0.0-beta.1",
"license": "TODO", "license": "TODO",
"dependencies": { "dependencies": {
"@ctrl/tinycolor": "^4.1.0", "@ctrl/tinycolor": "^4.1.0",

View File

@@ -715,7 +715,10 @@ export const elementPresets = themes.map(theme => ({
* All palettes used by themes in a simple array. * All palettes used by themes in a simple array.
*/ */
export const palettes = themes export const palettes = themes
.map(theme => theme.palette) .map(theme => ({
...theme.palette,
isPro: theme.isPro,
}))
.filter( .filter(
(palette, index, array) => (palette, index, array) =>
array.findIndex(p => p.name === palette.name && p.filename === palette.filename) === index, array.findIndex(p => p.name === palette.name && p.filename === palette.filename) === index,

View File

@@ -320,7 +320,10 @@
<ul> <ul>
<li><a href="/docs/color-palettes">Color Palettes</a></li> <li><a href="/docs/color-palettes">Color Palettes</a></li>
<li><a href="/docs/themes">Themes</a></li> <li><a href="/docs/themes">Themes</a></li>
<li><a href="/themer" data-turbo="false">Theme Builder</a></li> <li>
<a href="/themer" data-turbo="false">Theme Builder</a>
<wa-badge class="pro" appearance="accent" attention="none">PRO</wa-badge>
</li>
</ul> </ul>
<!-- Design tokens --> <!-- Design tokens -->

View File

@@ -2,7 +2,6 @@
title: Color Palettes title: Color Palettes
description: 'Color palettes give you a full spectrum of colors to add life to your project.' description: 'Color palettes give you a full spectrum of colors to add life to your project.'
layout: page layout: page
isPro: true
--- ---
<p>Color palettes give you a full spectrum of colors to add life to your project.</p> <p>Color palettes give you a full spectrum of colors to add life to your project.</p>
@@ -14,9 +13,36 @@ isPro: true
{% endfor %} {% endfor %}
<div id="color-palettes"> <div id="color-palettes">
{% raw %}
{% if not currentUser.hasPro %}
<p>
Additional palettes are available to pro users. Please <a href="/login">login to view pro palettes</a>.
</p>
{% endif %}
{% endraw %}
<wa-radio-group id="palette-picker" label="Color Palette" value="default" orientation="horizontal"> <wa-radio-group id="palette-picker" label="Color Palette" value="default" orientation="horizontal">
{% for palette in themer.palettes %} {% for palette in themer.palettes %}
<wa-radio class="palette-card" value="{{ palette.name | lower }}">{{ palette.name }}</wa-radio> {% if not palette.isPro %}
<wa-radio
class="palette-card"
value="{{ palette.name | lower }}"
>
{{ palette.name }}
</wa-radio>
{% else %}
{% raw %}
{% if currentUser.hasPro %}
{% endraw %}
<wa-radio
class="palette-card"
value="{{ palette.name | lower }}"
>
{{ palette.name }}
</wa-radio>
{% raw %}
{% endif %}
{% endraw %}
{% endif %}
{% endfor %} {% endfor %}
</wa-radio-group> </wa-radio-group>
@@ -124,13 +150,16 @@ isPro: true
border: 1px solid var(--wa-color-surface-border); border: 1px solid var(--wa-color-surface-border);
border-radius: var(--border-radius); border-radius: var(--border-radius);
box-shadow: var(--wa-shadow-s); box-shadow: var(--wa-shadow-s);
cursor: pointer;
transition: all 0.2s ease; transition: all 0.2s ease;
text-align: center; text-align: center;
font-weight: var(--wa-font-weight-action); font-weight: var(--wa-font-weight-action);
text-transform: capitalize; text-transform: capitalize;
} }
.palette-card:not(:state(disabled)) {
cursor: pointer;
}
.palette-card:state(checked) { .palette-card:state(checked) {
border-color: var(--wa-color-brand-border-loud); border-color: var(--wa-color-brand-border-loud);
background-color: var(--wa-color-brand-fill-quiet); background-color: var(--wa-color-brand-fill-quiet);

View File

@@ -2,7 +2,6 @@
title: Themes title: Themes
description: Themes galore description: Themes galore
layout: page layout: page
isPro: true
--- ---
<div class="wa-stack wa-gap-3xl"> <div class="wa-stack wa-gap-3xl">
@@ -16,17 +15,41 @@ isPro: true
</div> </div>
<div id="theme-viewer"> <div id="theme-viewer">
{% if not currentUser.hasPro %}
<p>
Additional themes are available to pro users. Please <a href="/login">login to view pro themes</a>.
</p>
{% endif %}
<wa-radio-group id="theme-picker" label="Theme Selector" value="default" orientation="horizontal"> <wa-radio-group id="theme-picker" label="Theme Selector" value="default" orientation="horizontal">
{% for theme in themer.themes %} {% for theme in themer.themes %}
<wa-radio {% if not theme.isPro %}
class="theme-card" <wa-radio
value="{{ theme.filename | stripExtension }}" class="theme-card"
data-description="{{ theme.description }}" value="{{ theme.filename | stripExtension }}"
data-title="{{ theme.name }}" data-description="{{ theme.description }}"
{% if theme.isPro %}data-is-pro{% endif %} data-title="{{ theme.name }}"
> {% if theme.isPro %}data-is-pro{% endif %}
{{ theme.name }} >
</wa-radio> {{ theme.name }}
</wa-radio>
{% else %}
{% raw %}
{% if currentUser.hasPro %}
{% endraw %}
<wa-radio
class="theme-card"
value="{{ theme.filename | stripExtension }}"
data-description="{{ theme.description }}"
data-title="{{ theme.name }}"
{% if theme.isPro %}data-is-pro{% endif %}
>
{{ theme.name }}
</wa-radio>
{% raw %}
{% endif %}
{% endraw %}
{% endif %}
{% endfor %} {% endfor %}
</wa-radio-group> </wa-radio-group>
</div> </div>
@@ -218,12 +241,15 @@ isPro: true
border: 1px solid var(--wa-color-surface-border); border: 1px solid var(--wa-color-surface-border);
border-radius: var(--border-radius); border-radius: var(--border-radius);
box-shadow: var(--wa-shadow-s); box-shadow: var(--wa-shadow-s);
cursor: pointer;
transition: all 0.2s ease; transition: all 0.2s ease;
text-align: center; text-align: center;
font-weight: var(--wa-font-weight-action); font-weight: var(--wa-font-weight-action);
text-transform: capitalize; text-transform: capitalize;
&:not(:state(disabled)) {
cursor: pointer;
}
&:state(checked) { &:state(checked) {
border-color: var(--wa-color-brand-border-loud); border-color: var(--wa-color-brand-border-loud);
background-color: var(--wa-color-brand-fill-quiet); background-color: var(--wa-color-brand-fill-quiet);