Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
📕 create story for Logo
Browse files Browse the repository at this point in the history
  • Loading branch information
XenoPOMP committed Apr 18, 2024
1 parent e403e2b commit 3bb7a2a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
18 changes: 10 additions & 8 deletions src/components/ui/Logo/Logo.module.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
a.logo {
@apply flex items-center;
&.sidebar {
@apply flex items-center justify-start;

padding: var(--p-level-2);
gap: var(--p-level-5);
font-size: var(--p24);
padding: var(--p-level-3);
gap: var(--p-level-5);
font-size: var(--p24);

// Border
border-color: inherit;
border-bottom-style: solid;
border-bottom-width: 1px;
// Border
border-color: inherit;
border-bottom-style: solid;
border-bottom-width: 1px;
}
}
4 changes: 3 additions & 1 deletion src/components/ui/Logo/Logo.props.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export interface LogoProps {}
export interface LogoProps {
variant?: 'sidebar';
}
22 changes: 22 additions & 0 deletions src/components/ui/Logo/Logo.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Meta, StoryObj } from '@storybook/react';

import Logo from './Logo';

const meta = {
title: 'UI/Logo',
component: Logo,
tags: ['autodoc'],
parameters: {
// layout: 'centered',
},
} satisfies Meta<typeof Logo>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Sidebar: Story = {
args: {
variant: 'sidebar',
},
};
15 changes: 13 additions & 2 deletions src/components/ui/Logo/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { VariableFC } from '@xenopomp/advanced-types';
import type { Defined, VariableFC } from '@xenopomp/advanced-types';
import cn from 'classnames';
import { SquareGanttChart } from 'lucide-react';
import Link from 'next/link';
import { type ComponentProps } from 'react';

import { AppConstants } from '@/app/app.constants.ts';

Expand All @@ -10,12 +11,22 @@ import type { LogoProps } from './Logo.props';

const Logo: VariableFC<typeof Link, LogoProps, 'children' | 'href'> = ({
className,
variant = 'sidebar',
...props
}) => {
const variantsMap: Record<
Defined<typeof variant>,
Pick<ComponentProps<typeof Link>, 'className'>
> = {
sidebar: {
className: styles.sidebar,
},
};

return (
<Link
href={'/'}
className={cn(styles.logo, className)}
className={cn(styles.logo, variantsMap[variant].className, className)}
{...props}
>
<SquareGanttChart
Expand Down

0 comments on commit 3bb7a2a

Please sign in to comment.