-
-
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.
feat(app): add QuestionsSidebar (#392)
* feat(app): add QuestionsSidebar * chore(app): remove clsx * feat(app): add mobile action buttons * refactor(app): change colors notation to oklch * feat(app): add label to mobile action buttons * feat(app): create questions page layout * refactor(app): refactor shadows * refactor(app): refactor LevelButton styles * refactor(app): remove unused classes * fix(app): fix z-index values * refactor(app): close QuestionsSidebar by default Co-authored-by: Michał Miszczyszyn <michal@mmiszy.pl>
- Loading branch information
Showing
32 changed files
with
540 additions
and
66 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ReactNode } from "react"; | ||
import { Container } from "../../components/Container"; | ||
import { MobileActionButtons } from "../../components/MobileActionButtons/MobileActionButtons"; | ||
import { QuestionsSidebar } from "../../components/QuestionsSidebar/QuestionsSidebar"; | ||
|
||
const QuestionsPageLayout = ({ children }: { readonly children: ReactNode }) => ( | ||
<> | ||
<Container className="flex"> | ||
<QuestionsSidebar /> | ||
<main className="grow">{children}</main> | ||
</Container> | ||
<MobileActionButtons /> | ||
</> | ||
); | ||
|
||
export default QuestionsPageLayout; |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const QuestionsPage = () => { | ||
return <strong>Questions</strong>; | ||
}; | ||
|
||
export default QuestionsPage; |
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
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
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
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
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
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
14 changes: 14 additions & 0 deletions
14
apps/app/src/components/MobileActionButtons/MobileActionButton.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ReactNode } from "react"; | ||
|
||
type MobileActionButtonProps = Readonly<{ | ||
children: ReactNode; | ||
"aria-label": string; | ||
onClick: () => void; | ||
}>; | ||
|
||
export const MobileActionButton = (props: MobileActionButtonProps) => ( | ||
<button | ||
className="flex h-11 w-11 appearance-none items-center justify-center rounded-full bg-primary shadow-md shadow-neutral-600 dark:shadow-neutral-900" | ||
{...props} | ||
/> | ||
); |
24 changes: 24 additions & 0 deletions
24
apps/app/src/components/MobileActionButtons/MobileActionButtons.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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use client"; | ||
|
||
import ActionIconFilter from "../../../public/icons/action-icon-filter.svg"; | ||
import ActionIconAdd from "../../../public/icons/action-icon-add.svg"; | ||
import { useUIContext } from "../../providers/UIProvider"; | ||
import { MobileActionButton } from "./MobileActionButton"; | ||
|
||
export const MobileActionButtons = () => { | ||
const { openSidebar, openModal } = useUIContext(); | ||
|
||
return ( | ||
<div className="sticky bottom-0 left-1/2 flex w-full justify-center gap-4 pb-7 sm:hidden"> | ||
<MobileActionButton aria-label="Otwórz sidebar" onClick={openSidebar}> | ||
<ActionIconFilter /> | ||
</MobileActionButton> | ||
<MobileActionButton | ||
aria-label="Dodaj nowe pytanie" | ||
onClick={() => openModal("AddQuestionModal")} | ||
> | ||
<ActionIconAdd /> | ||
</MobileActionButton> | ||
</div> | ||
); | ||
}; |
25 changes: 25 additions & 0 deletions
25
apps/app/src/components/QuestionsSidebar/LevelFilter/LevelButton.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ReactNode } from "react"; | ||
import { twMerge } from "tailwind-merge"; | ||
|
||
type LevelButtonProps = Readonly<{ | ||
variant: "junior" | "mid" | "senior"; | ||
isActive: boolean; | ||
children: ReactNode; | ||
}>; | ||
|
||
export const LevelButton = ({ variant, isActive, children }: LevelButtonProps) => ( | ||
<button | ||
className={twMerge( | ||
"h-20 w-20 transition-colors duration-100 sm:h-8 sm:w-full small-filters:h-14 small-filters:w-14", | ||
"rounded-md text-sm text-neutral-500 active:translate-y-px dark:text-neutral-200", | ||
!isActive && | ||
"level-button bg-white shadow-[0px_1px_4px] shadow-neutral-400 dark:shadow-neutral-900", | ||
isActive && "level-button-active text-white", | ||
variant === "junior" && "level-button-junior", | ||
variant === "mid" && "level-button-mid", | ||
variant === "senior" && "level-button-senior", | ||
)} | ||
> | ||
{children} | ||
</button> | ||
); |
20 changes: 20 additions & 0 deletions
20
apps/app/src/components/QuestionsSidebar/LevelFilter/LevelFilter.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { QuestionsSidebarSection } from "../QuestionsSidebarSection"; | ||
import { LevelButton } from "./LevelButton"; | ||
|
||
export const LevelFilter = () => { | ||
return ( | ||
<QuestionsSidebarSection title="Wybierz poziom"> | ||
<div className="flex justify-center gap-3 sm:flex-col small-filters:flex-row"> | ||
<LevelButton variant="junior" isActive={true}> | ||
Junior | ||
</LevelButton> | ||
<LevelButton variant="mid" isActive={false}> | ||
Mid | ||
</LevelButton> | ||
<LevelButton variant="senior" isActive={false}> | ||
Senior | ||
</LevelButton> | ||
</div> | ||
</QuestionsSidebarSection> | ||
); | ||
}; |
30 changes: 30 additions & 0 deletions
30
apps/app/src/components/QuestionsSidebar/QuestionsSidebar.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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use client"; | ||
|
||
import { twMerge } from "tailwind-merge"; | ||
import { useUIContext } from "../../providers/UIProvider"; | ||
import { Button } from "../Button/Button"; | ||
import { CloseButton } from "../CloseButton/CloseButton"; | ||
import { LevelFilter } from "./LevelFilter/LevelFilter"; | ||
import { TechnologyFilter } from "./TechnologyFilter/TechnologyFilter"; | ||
|
||
export const QuestionsSidebar = () => { | ||
const { isSidebarOpen, closeSidebar } = useUIContext(); | ||
|
||
return ( | ||
<aside | ||
className={twMerge( | ||
"fixed top-0 left-0 bottom-0 right-0 z-50 flex -translate-x-full transform-gpu flex-col bg-gray-50 px-2.5 pb-4 transition-transform duration-200 dark:bg-neutral-800", | ||
"after:absolute after:top-0 after:bottom-0 after:right-0 after:hidden after:w-px after:shadow-[4px_0px_4px_rgba(0,0,0,0.23)]", | ||
"sm:sticky sm:top-[56px] sm:z-auto sm:h-screen sm:w-60 sm:translate-x-0 sm:p-0 sm:pr-10 sm:transition-none sm:after:inline", | ||
isSidebarOpen && "translate-x-0", | ||
)} | ||
> | ||
<TechnologyFilter /> | ||
<LevelFilter /> | ||
<Button variant="brandingInverse" className="mt-auto sm:hidden"> | ||
Pokaż wyniki | ||
</Button> | ||
<CloseButton className="absolute top-1 right-1 sm:hidden" onClick={closeSidebar} /> | ||
</aside> | ||
); | ||
}; |
15 changes: 15 additions & 0 deletions
15
apps/app/src/components/QuestionsSidebar/QuestionsSidebarSection.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ReactNode } from "react"; | ||
|
||
type QuestionsSidebarSection = Readonly<{ | ||
title: string; | ||
children: ReactNode; | ||
}>; | ||
|
||
export const QuestionsSidebarSection = ({ title, children }: QuestionsSidebarSection) => ( | ||
<section className="mt-6"> | ||
<h2 className="mb-6 border-b border-violet-700 pb-2 text-sm text-violet-700 dark:border-neutral-200 dark:text-neutral-200"> | ||
{title} | ||
</h2> | ||
{children} | ||
</section> | ||
); |
Oops, something went wrong.