Skip to content

Commit

Permalink
feat: Simplify & test ThemeCard
Browse files Browse the repository at this point in the history
  • Loading branch information
steezplusplus committed Sep 18, 2023
1 parent c4a35ec commit af49220
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/_components/cards/music-card/music-card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const props = {
subLabel: 'subLabel',
};

describe('<Nav />', () => {
it('Should render an anchor', () => {
describe('<MusicCard />', () => {
it('Should expected elements', () => {
render(<MusicCard {...props} />);
const h2 = screen.getByRole('heading', { level: 2 });
const h3 = screen.getByRole('heading', { level: 3 });
Expand Down
14 changes: 14 additions & 0 deletions app/_components/cards/theme-card/theme-card.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { render, screen } from '@testing-library/react';
import { ThemeCard } from './theme-card';

const props = {
label: 'label',
};

describe('<ThemeCard />', () => {
it('Should render expected elements', () => {
render(<ThemeCard {...props} />);
const h2 = screen.getByRole('heading', { level: 2 });
expect(h2).toHaveTextContent(props.label);
});
});
6 changes: 1 addition & 5 deletions app/_components/cards/theme-card/theme-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { ThemeSelect } from './theme-select/theme-select';

type ThemeCardProps = {
label: string;
subLabel?: string;
icon: JSX.Element;
};

export function ThemeCard(props: ThemeCardProps) {
const { label, subLabel, icon } = props;
const { label } = props;
return (
<div
className="
Expand All @@ -17,9 +15,7 @@ export function ThemeCard(props: ThemeCardProps) {
"
>
<h2 className="mb-1 text-lg">{label}</h2>
{subLabel && <h3 className="text-sm italic">{subLabel}</h3>}
<ThemeSelect />
<div className="mt-2 self-end">{icon}</div>
</div>
);
}
2 changes: 0 additions & 2 deletions app/_schema/schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export const contactSchema = {

export const themeSchema = {
label: 'Theme',
subLabel: '',
icon: <></>,
};

export const musicSchema = {
Expand Down

0 comments on commit af49220

Please sign in to comment.