feat(logo): consolidate logo imports into a single export file
This commit is contained in:
parent
f0e23139a2
commit
49b3869d7b
3 changed files with 22 additions and 41 deletions
16
src/assets/logo/logo-export.ts
Normal file
16
src/assets/logo/logo-export.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
export { default as logo_colored_combo_light } from '@/assets/logo/logo_colored_combo_light.svg';
|
||||||
|
export { default as logo_colored_combo_dark } from '@/assets/logo/logo_colored_combo_dark.svg';
|
||||||
|
export { default as logo_colored_primary_light } from '@/assets/logo/logo_colored_primary_light.svg';
|
||||||
|
export { default as logo_colored_primary_dark } from '@/assets/logo/logo_colored_primary_dark.svg';
|
||||||
|
export { default as logo_colored_secondary_light } from '@/assets/logo/logo_colored_secondary_light.svg';
|
||||||
|
export { default as logo_colored_secondary_dark } from '@/assets/logo/logo_colored_secondary_dark.svg';
|
||||||
|
export { default as logo_mono_combo_light } from '@/assets/logo/logo_mono_combo_light.svg';
|
||||||
|
export { default as logo_mono_combo_dark } from '@/assets/logo/logo_mono_combo_dark.svg';
|
||||||
|
export { default as logo_mono_primary_light } from '@/assets/logo/logo_mono_primary_light.svg';
|
||||||
|
export { default as logo_mono_primary_dark } from '@/assets/logo/logo_mono_primary_dark.svg';
|
||||||
|
export { default as logo_mono_secondary_light } from '@/assets/logo/logo_mono_secondary_light.svg';
|
||||||
|
export { default as logo_mono_secondary_dark } from '@/assets/logo/logo_mono_secondary_dark.svg';
|
||||||
|
export { default as logo_mono_submark_light } from '@/assets/logo/logo_mono_submark_light.svg';
|
||||||
|
export { default as logo_mono_submark_dark } from '@/assets/logo/logo_mono_submark_dark.svg';
|
||||||
|
export { default as logo_colored_submark_light } from '@/assets/logo/logo_colored_submark_light.svg';
|
||||||
|
export { default as logo_colored_submark_dark } from '@/assets/logo/logo_colored_submark_dark.svg';
|
|
@ -15,9 +15,6 @@ const buttonVariants = cva(
|
||||||
'bg-secondary text-text-alt shadow-xs hover:bg-hover-secondary active:bg-active-secondary',
|
'bg-secondary text-text-alt shadow-xs hover:bg-hover-secondary active:bg-active-secondary',
|
||||||
outline:
|
outline:
|
||||||
'border-2 border-primary bg-transparent text-text shadow-xs hover:bg-primary hover:border-neutral-000 hover:border-1.5 hover:text-neutral-000 active:bg-active-primary',
|
'border-2 border-primary bg-transparent text-text shadow-xs hover:bg-primary hover:border-neutral-000 hover:border-1.5 hover:text-neutral-000 active:bg-active-primary',
|
||||||
/*destructive:
|
|
||||||
'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
||||||
*/
|
|
||||||
ghost:
|
ghost:
|
||||||
'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
||||||
link: 'text-text underline-offset-4 hover:underline',
|
link: 'text-text underline-offset-4 hover:underline',
|
||||||
|
|
|
@ -3,22 +3,7 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import Image, { ImageProps } from 'next/image';
|
import Image, { ImageProps } from 'next/image';
|
||||||
|
|
||||||
import logo_colored_combo_light from '@/assets/logo/logo_colored_combo_light.svg';
|
import * as logoAssets from '@/assets/logo/logo-export';
|
||||||
import logo_colored_combo_dark from '@/assets/logo/logo_colored_combo_dark.svg';
|
|
||||||
import logo_colored_primary_light from '@/assets/logo/logo_colored_primary_light.svg';
|
|
||||||
import logo_colored_primary_dark from '@/assets/logo/logo_colored_primary_dark.svg';
|
|
||||||
import logo_colored_secondary_light from '@/assets/logo/logo_colored_secondary_light.svg';
|
|
||||||
import logo_colored_secondary_dark from '@/assets/logo/logo_colored_secondary_dark.svg';
|
|
||||||
import logo_mono_combo_light from '@/assets/logo/logo_mono_combo_light.svg';
|
|
||||||
import logo_mono_combo_dark from '@/assets/logo/logo_mono_combo_dark.svg';
|
|
||||||
import logo_mono_primary_light from '@/assets/logo/logo_mono_primary_light.svg';
|
|
||||||
import logo_mono_primary_dark from '@/assets/logo/logo_mono_primary_dark.svg';
|
|
||||||
import logo_mono_secondary_light from '@/assets/logo/logo_mono_secondary_light.svg';
|
|
||||||
import logo_mono_secondary_dark from '@/assets/logo/logo_mono_secondary_dark.svg';
|
|
||||||
import logo_mono_submark_light from '@/assets/logo/logo_mono_submark_light.svg';
|
|
||||||
import logo_mono_submark_dark from '@/assets/logo/logo_mono_submark_dark.svg';
|
|
||||||
import logo_colored_submark_light from '@/assets/logo/logo_colored_submark_light.svg';
|
|
||||||
import logo_colored_submark_dark from '@/assets/logo/logo_colored_submark_dark.svg';
|
|
||||||
import { useTheme } from 'next-themes';
|
import { useTheme } from 'next-themes';
|
||||||
|
|
||||||
type ColorType = 'colored' | 'monochrome';
|
type ColorType = 'colored' | 'monochrome';
|
||||||
|
@ -47,7 +32,9 @@ export default function Logo({
|
||||||
...imageProps
|
...imageProps
|
||||||
}: LogoProps) {
|
}: LogoProps) {
|
||||||
const [mounted, setMounted] = useState(false);
|
const [mounted, setMounted] = useState(false);
|
||||||
let { resolvedTheme: theme } = useTheme();
|
let { resolvedTheme: theme } = useTheme() as {
|
||||||
|
resolvedTheme?: Theme;
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setMounted(true);
|
setMounted(true);
|
||||||
|
@ -84,29 +71,10 @@ export default function Logo({
|
||||||
|
|
||||||
const colorTypeInFilename = colorType === 'monochrome' ? 'mono' : colorType;
|
const colorTypeInFilename = colorType === 'monochrome' ? 'mono' : colorType;
|
||||||
const defaultAltText = `Logo: ${colorType} ${logoType} ${theme}`;
|
const defaultAltText = `Logo: ${colorType} ${logoType} ${theme}`;
|
||||||
const varName = `logo_${colorTypeInFilename}_${logoType}_${theme}`;
|
const varName = `logo_${colorTypeInFilename}_${logoType}_${theme}` as const;
|
||||||
|
|
||||||
const logoAssets = {
|
|
||||||
logo_colored_combo_light,
|
|
||||||
logo_colored_combo_dark,
|
|
||||||
logo_colored_primary_light,
|
|
||||||
logo_colored_primary_dark,
|
|
||||||
logo_colored_secondary_light,
|
|
||||||
logo_colored_secondary_dark,
|
|
||||||
logo_mono_combo_light,
|
|
||||||
logo_mono_combo_dark,
|
|
||||||
logo_mono_primary_light,
|
|
||||||
logo_mono_primary_dark,
|
|
||||||
logo_mono_secondary_light,
|
|
||||||
logo_mono_secondary_dark,
|
|
||||||
logo_mono_submark_light,
|
|
||||||
logo_mono_submark_dark,
|
|
||||||
logo_colored_submark_light,
|
|
||||||
logo_colored_submark_dark,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Match the varName with the Logo-Asset name and store it in "logoVar"
|
// Match the varName with the Logo-Asset name and store it in "logoVar"
|
||||||
const logoVar = logoAssets[varName as keyof typeof logoAssets];
|
const logoVar = logoAssets[varName];
|
||||||
|
|
||||||
if (!logoVar) {
|
if (!logoVar) {
|
||||||
console.error(`Logo: Could not find logo asset for ${varName}`);
|
console.error(`Logo: Could not find logo asset for ${varName}`);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue