Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18 feature create tabtsx component #63

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/error.tsx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is unrelated, make sure to pull dev and git checkout <source-branch> -- <path/to/file> to reset the file so that it isn't included in the PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure this file is unchanged in the last commit

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use client';

import { VerticalLine } from '@/components/atoms';
import { VerticalLine, Tab, Tag } from '@/components/atoms';
import React from 'react';
import Link from 'next/link'

export default function Error({
error,
Expand Down Expand Up @@ -34,6 +35,7 @@ export default function Error({
</div>
<div className="max-lg:min-w-line-mobile lg:min-w-line-desktop" />
</section>

</main>
);
}
3 changes: 2 additions & 1 deletion components/atoms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export * from './vertical-line';
export * from './link-btn';
export * from './card';
export * from './tag';
export * from './file-input';
export * from './file-input';
export * from './tab';
30 changes: 30 additions & 0 deletions components/atoms/tab/component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {cn} from '@/lib/cn';
import React from 'react';

interface Props extends React.HTMLAttributes<HTMLInputElement>{
children?: React.ReactNode;
}
/*
*peer-checked: I have no idea, I don't think its implemented yet
*peer-focus: selected tab
*peer-enabled: the one you're clicking on?
*/
export const Tab: React.FC<Props> = ({ children, className, ...props }) => {
const [id, setId] = React.useState('');
React.useEffect(() => setId(Math.random().toString(36).substring(7)), []);
return (
<span className={cn('block w-[100%] max-w-[120px] text-center')}>
<input {...props} className="peer sr-only" id={id} type="radio"/>
<label
className={cn(
'flex cursor-pointer items-center gap-xs px-md py-sm opacity-25 peer-checked:!opacity-100 peer-checked:border-b-line-width peer-focus:outline-none peer-enabled:hover:opacity-50 peer-enabled:active:opacity-100 peer-enabled:active:border-b-line-width ',
className,
)}
htmlFor={id}
>
{children}
</label>
</span>

);
};
2 changes: 2 additions & 0 deletions components/atoms/tab/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Tab as default } from './component';
export * from './component';