-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
78 additions
and
24 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 52 additions & 15 deletions
67
apps/app/src/components/QuestionsSidebar/TechnologyFilter/Technology.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,61 @@ | ||
import { ReactElement } from "react"; | ||
import { twMerge } from "tailwind-merge"; | ||
import { ActiveLink } from "../../ActiveLink"; | ||
|
||
type TechnologyProps = Readonly<{ | ||
technology: string; | ||
technologyTitle: string; | ||
icon: ReactElement; | ||
}>; | ||
|
||
export const Technology = ({ technology, technologyTitle, icon }: TechnologyProps) => ( | ||
<TechnologyLink | ||
label={technologyTitle} | ||
title={`Wyświetl pytania z kategorii ${technologyTitle}`} | ||
href={`/questions/${technology}/1`} | ||
activeHref={`/questions/${technology}`} | ||
icon={icon} | ||
/> | ||
); | ||
|
||
type TechnologyLinkProps = Readonly<{ | ||
href: string; | ||
title: string; | ||
label: string; | ||
icon: ReactElement; | ||
transparent?: boolean; | ||
activeHref?: string; | ||
target?: string; | ||
}>; | ||
|
||
export const Technology = ({ href, title, icon }: TechnologyProps) => ( | ||
<ActiveLink | ||
className="flex min-h-[85px] min-w-[85px] cursor-pointer flex-col items-center justify-center rounded-lg bg-white shadow-[0px_1px_4px] shadow-neutral-400 transition-colors hover:bg-violet-50 dark:bg-white-dark dark:shadow-neutral-900 hover:dark:bg-violet-900 small-filters:h-14 small-filters:min-h-[unset] small-filters:w-14 small-filters:min-w-[unset] small-filters:[&>svg]:h-7 small-filters:[&>svg]:w-7" | ||
activeClassName="border border-primary bg-violet-50 dark:bg-violet-900" | ||
title={`Wyświetl pytania z kategorii ${title}`} | ||
href={`/questions/${href}/1`} | ||
activeHref={`/questions/${href}`} | ||
mergeQuery | ||
> | ||
<span className="text-sm text-neutral-600 dark:text-neutral-200 small-filters:text-xs"> | ||
{title} | ||
</span> | ||
{icon} | ||
</ActiveLink> | ||
); | ||
export const TechnologyLink = ({ | ||
href, | ||
title, | ||
label, | ||
transparent, | ||
activeHref, | ||
icon, | ||
target, | ||
}: TechnologyLinkProps) => { | ||
return ( | ||
<ActiveLink | ||
className={twMerge( | ||
`flex min-h-[85px] min-w-[85px] cursor-pointer flex-col items-center justify-center rounded-lg transition hover:bg-violet-50 hover:dark:bg-violet-900 small-filters:h-14 small-filters:min-h-[unset] small-filters:w-14 small-filters:min-w-[unset] small-filters:[&>svg]:h-7 small-filters:[&>svg]:w-7`, | ||
transparent | ||
? `hover:shadow-[0px_1px_4px] hover:shadow-neutral-400 hover:dark:bg-white-dark hover:dark:shadow-neutral-900` | ||
: `bg-white shadow-[0px_1px_4px] shadow-neutral-400 dark:bg-white-dark dark:shadow-neutral-900`, | ||
)} | ||
activeClassName="border border-primary bg-violet-50 dark:bg-violet-900" | ||
title={title} | ||
href={href} | ||
activeHref={activeHref} | ||
target={target} | ||
mergeQuery | ||
> | ||
<span className="text-sm text-neutral-600 dark:text-neutral-200 small-filters:text-xs"> | ||
{label} | ||
</span> | ||
{icon} | ||
</ActiveLink> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters