Skip to content

Commit 7b109a7

Browse files
authored
Merge pull request xch-dev#623 from dkackman/bug-622
Fix checkbox state Bug 622
2 parents bbf2ed2 + afa7e58 commit 7b109a7

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

src/components/NftCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ export function NftCard({ nft, updateNfts, selectionState }: NftCardProps) {
341341
)}
342342

343343
{nft.special_use_type === 'theme' && (
344-
<div className='absolute bottom-0 left-0 right-0 bg-background/80 text-primary text-xs font-medium py-1 px-2 text-center border-t border-border'>
344+
<div className='absolute bottom-0 left-0 right-0 bg-primary/70 text-primary-foreground text-xs font-medium py-1 px-2 text-center border-t border-border'>
345345
<Trans>Theme</Trans>
346346
</div>
347347
)}

src/components/ThemeCard.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { useErrors } from '@/hooks/useErrors';
44
import {
55
type Theme,
66
applyTheme,
7-
getButtonStyles,
8-
getHeadingStyles,
9-
getMutedTextStyles,
10-
getTextStyles,
7+
getPreviewButtonStyles,
8+
getPreviewHeadingStyles,
9+
getPreviewMutedTextStyles,
10+
getPreviewTextStyles,
1111
} from '@/lib/theme';
1212
import { t } from '@lingui/core/macro';
1313
import { Trans } from '@lingui/react/macro';
@@ -92,10 +92,10 @@ export function ThemeCard({
9292
: {};
9393

9494
const renderDefaultContent = () => {
95-
const buttonStyles = getButtonStyles(theme, 'default');
96-
const headingStyles = getHeadingStyles(theme);
97-
const mutedTextStyles = getMutedTextStyles(theme);
98-
const textStyles = getTextStyles(theme);
95+
const buttonStyles = getPreviewButtonStyles(theme, 'default');
96+
const headingStyles = getPreviewHeadingStyles(theme);
97+
const mutedTextStyles = getPreviewMutedTextStyles(theme);
98+
const textStyles = getPreviewTextStyles(theme);
9999

100100
// Add fallbacks for button styles
101101
if (!buttonStyles.backgroundColor) {
@@ -214,7 +214,7 @@ export function ThemeCard({
214214
};
215215

216216
const renderSimpleContent = () => {
217-
const headingStyles = getHeadingStyles(theme);
217+
const headingStyles = getPreviewHeadingStyles(theme);
218218

219219
// Add fallbacks for heading styles
220220
if (!headingStyles.fontFamily) {
@@ -235,7 +235,13 @@ export function ThemeCard({
235235
{theme.displayName}
236236
</h4>
237237
<div className='flex items-center gap-1'>
238-
{isSelected && <Check className='h-3 w-3' style={checkStyles} />}
238+
{isSelected && (
239+
<Check
240+
className='h-3 w-3'
241+
style={checkStyles}
242+
aria-label={t`Theme selected`}
243+
/>
244+
)}
239245
{theme.isUserTheme && (
240246
<Button
241247
onClick={handleDeleteClick}

src/components/ui/switch.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ const Switch = React.forwardRef<
1212

1313
// Get custom switch colors with defaults
1414
const checkedBg =
15-
currentTheme?.switches?.checked?.background || 'hsl(var(--primary))';
15+
currentTheme?.switches?.checked?.background || 'var(--primary)';
1616
const uncheckedBg =
17-
currentTheme?.switches?.unchecked?.background || 'hsl(var(--border))';
17+
currentTheme?.switches?.unchecked?.background || 'var(--border)';
1818

1919
return (
2020
<SwitchPrimitives.Root
2121
className={cn(
22-
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50',
22+
'peer switch-component inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50',
2323
className,
2424
)}
2525
style={

src/index.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,11 @@ body {
349349
}
350350

351351
/* Custom switch styling */
352-
.peer[data-state='checked'] {
352+
.switch-component.peer[data-state='checked'] {
353353
background-color: var(--switch-checked-bg) !important;
354354
}
355355

356-
.peer[data-state='unchecked'] {
356+
.switch-component.peer[data-state='unchecked'] {
357357
background-color: var(--switch-unchecked-bg) !important;
358358
}
359359

src/lib/theme.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -772,10 +772,7 @@ export function getThemeStyles(theme: Theme): Record<string, string> {
772772
return styles;
773773
}
774774

775-
/**
776-
* Gets button styles for a specific variant from a theme
777-
*/
778-
export function getButtonStyles(
775+
export function getPreviewButtonStyles(
779776
theme: Theme,
780777
variant:
781778
| 'default'
@@ -826,10 +823,7 @@ export function getButtonStyles(
826823
return styles;
827824
}
828825

829-
/**
830-
* Gets heading styles from a theme
831-
*/
832-
export function getHeadingStyles(theme: Theme): Record<string, string> {
826+
export function getPreviewHeadingStyles(theme: Theme): Record<string, string> {
833827
const styles: Record<string, string> = {};
834828

835829
if (theme.fonts?.heading) {
@@ -839,7 +833,9 @@ export function getHeadingStyles(theme: Theme): Record<string, string> {
839833
return styles;
840834
}
841835

842-
export function getMutedTextStyles(theme: Theme): Record<string, string> {
836+
export function getPreviewMutedTextStyles(
837+
theme: Theme,
838+
): Record<string, string> {
843839
const styles: Record<string, string> = {};
844840

845841
if (theme.colors?.mutedForeground) {
@@ -852,11 +848,11 @@ export function getMutedTextStyles(theme: Theme): Record<string, string> {
852848
return styles;
853849
}
854850

855-
export function getTextStyles(theme: Theme): Record<string, string> {
851+
export function getPreviewTextStyles(theme: Theme): Record<string, string> {
856852
const styles: Record<string, string> = {};
857853

858-
if (theme.colors?.secondary) {
859-
styles.color = theme.colors.secondary;
854+
if (theme.colors?.primaryForeground) {
855+
styles.color = theme.colors.primaryForeground;
860856
}
861857
if (theme.fonts?.body) {
862858
styles.fontFamily = theme.fonts.body;

src/themes/circuit/theme.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"header": {
6666
"background": "rgba(14, 165, 233, 0.1)",
6767
"color": "#e0f2fe",
68-
"border": "1px solid rgba(59, 130, 246, 0.2)",
6968
"fontWeight": "600",
7069
"fontSize": "14px"
7170
},
@@ -83,7 +82,6 @@
8382
}
8483
},
8584
"cell": {
86-
"padding": "12px 16px",
8785
"fontSize": "14px"
8886
},
8987
"footer": {

0 commit comments

Comments
 (0)