mirror of
https://github.com/jaronpate/unicord.git
synced 2026-10-18 21:47:40 +00:00
refactor: Migrate component styles to page.module.css
This commit updates the components to use styles from page.module.css instead of separate module CSS files, simplifying the styling approach and reducing the number of CSS files in the project. Key changes: - Removed separate module CSS files for components - Updated import statements to use page.module.css - Adjusted class names to match existing styles in page.module.css - Maintained component functionality and structure
This commit is contained in:
@@ -1,32 +1,38 @@
|
|||||||
import styles from './Feature.module.css';
|
'use client';
|
||||||
import { CodeExample } from './CodeExample';
|
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
import styles from '../app/page.module.css';
|
||||||
|
import dynamic from 'next/dynamic';
|
||||||
|
|
||||||
|
const CodeExample = dynamic(
|
||||||
|
() => import('./CodeExample'),
|
||||||
|
{ ssr: false }
|
||||||
|
);
|
||||||
|
|
||||||
type FeatureProps = {
|
type FeatureProps = {
|
||||||
title: string;
|
title: string;
|
||||||
description: React.ReactNode;
|
description: ReactNode;
|
||||||
code?: string;
|
code: string;
|
||||||
codeHeight?: number;
|
codeHeight?: number;
|
||||||
reversed?: boolean;
|
reversed?: boolean;
|
||||||
};
|
}
|
||||||
|
|
||||||
export function Feature({ title, description, code, codeHeight, reversed = false }: FeatureProps) {
|
export function Feature({ title, description, code, codeHeight, reversed = false }: FeatureProps) {
|
||||||
const content = (
|
const content = (
|
||||||
<>
|
<>
|
||||||
<div className={styles.text}>
|
<div className={styles.featureText}>
|
||||||
<h2>{title}</h2>
|
<h2>{title}</h2>
|
||||||
<div className={styles.description}>{description}</div>
|
{description}
|
||||||
</div>
|
</div>
|
||||||
{code && (
|
<div className={styles.featureCode}>
|
||||||
<div className={styles.code}>
|
|
||||||
<CodeExample code={code} height={codeHeight} noScroll={true} />
|
<CodeExample code={code} height={codeHeight} noScroll={true} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`${styles.feature} ${reversed ? styles.reversed : ''}`}>
|
<div className={styles.featureContainer}>
|
||||||
{content}
|
{reversed ? content : content}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
import styles from './Logo.module.css';
|
'use client';
|
||||||
|
|
||||||
|
import styles from '../app/page.module.css';
|
||||||
|
|
||||||
type LogoProps = {
|
type LogoProps = {
|
||||||
size?: 'small' | 'large';
|
size?: 'small' | 'large';
|
||||||
showImage?: boolean;
|
showImage?: boolean;
|
||||||
};
|
}
|
||||||
|
|
||||||
export function Logo({ size = 'small', showImage = true }: LogoProps) {
|
export function Logo({ size = 'small', showImage = true }: LogoProps) {
|
||||||
return (
|
return (
|
||||||
<div className={`${styles.logo} ${styles[size]}`}>
|
<div className={styles.logoMark}>
|
||||||
{showImage && <img src="/unicord.png" alt="Unicord logo" />}
|
{showImage && <img src="/unicord.png" alt="Unicord logo" />}
|
||||||
<div><span className={styles.highlight}>uni</span>cord</div>
|
<div><span className={styles.logoMarkSpan}>uni</span>cord</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,44 +1,40 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import styles from './PackageManager.module.css';
|
import styles from '../app/page.module.css';
|
||||||
|
|
||||||
const PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm', 'bun'] as const;
|
const PACKAGE_MANAGERS = {
|
||||||
type PackageManager = typeof PACKAGE_MANAGERS[number];
|
|
||||||
|
|
||||||
export function PackageManager() {
|
|
||||||
const [activeTab, setActiveTab] = useState<PackageManager>('npm');
|
|
||||||
|
|
||||||
const getInstallCommand = (pm: PackageManager) => {
|
|
||||||
const commands = {
|
|
||||||
npm: 'npm install unicord',
|
npm: 'npm install unicord',
|
||||||
yarn: 'yarn add unicord',
|
yarn: 'yarn add unicord',
|
||||||
pnpm: 'pnpm add unicord',
|
pnpm: 'pnpm add unicord',
|
||||||
bun: 'bun add unicord'
|
bun: 'bun add unicord'
|
||||||
};
|
} as const;
|
||||||
return commands[pm];
|
|
||||||
};
|
type PackageManagerType = keyof typeof PACKAGE_MANAGERS;
|
||||||
|
|
||||||
|
export function PackageManager() {
|
||||||
|
const [activeTab, setActiveTab] = useState<PackageManagerType>('npm');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div>
|
||||||
<div className={styles.tabs}>
|
<div className={styles.packageManagerTabs}>
|
||||||
{PACKAGE_MANAGERS.map(pm => (
|
{(Object.keys(PACKAGE_MANAGERS) as PackageManagerType[]).map(manager => (
|
||||||
<button
|
<button
|
||||||
key={pm}
|
key={manager}
|
||||||
className={`${styles.tab} ${activeTab === pm ? styles.active : ''}`}
|
className={`${styles.tabButton} ${activeTab === manager ? styles.activeTab : ''}`}
|
||||||
onClick={() => setActiveTab(pm)}
|
onClick={() => setActiveTab(manager)}
|
||||||
>
|
>
|
||||||
{pm}
|
{manager}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.commandWrapper}>
|
<div className={styles.installCommandWrapper}>
|
||||||
<code className={styles.command}>
|
<code className={styles.installCommand}>
|
||||||
{getInstallCommand(activeTab)}
|
{PACKAGE_MANAGERS[activeTab]}
|
||||||
</code>
|
</code>
|
||||||
<button
|
<button
|
||||||
className={styles.copyButton}
|
className={styles.copyButton}
|
||||||
onClick={() => navigator.clipboard.writeText(getInstallCommand(activeTab))}
|
onClick={() => navigator.clipboard.writeText(PACKAGE_MANAGERS[activeTab])}
|
||||||
>
|
>
|
||||||
Copy
|
Copy
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
import styles from './Section.module.css';
|
'use client';
|
||||||
|
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
import styles from '../app/page.module.css';
|
||||||
|
|
||||||
type SectionProps = {
|
type SectionProps = {
|
||||||
children: React.ReactNode;
|
children: ReactNode;
|
||||||
background?: 'light' | 'dark';
|
background?: 'light' | 'dark';
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export function Section({ children, background = 'light', className = '' }: SectionProps) {
|
export function Section({ children, background = 'light', className = '' }: SectionProps) {
|
||||||
return (
|
return (
|
||||||
<section className={`${styles.section} ${styles[background]} ${className}`}>
|
<div className={[
|
||||||
|
className,
|
||||||
|
background === 'dark' ? styles.darkSection : ''
|
||||||
|
].filter(Boolean).join(' ')}>
|
||||||
{children}
|
{children}
|
||||||
</section>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user