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

feat: icons for filters in drawer #23

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@fontsource/rubik": "5.0.18",
"@heroicons/react": "2.1.1",
"@pixi/filter-adjustment": "5.1.1",
"@pixi/filter-pixelate": "5.1.1",
"@pixi/react": "7.1.1",
"clsx": "2.1.0",
"immer": "10.0.3",
Expand Down
30 changes: 27 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/components/icons/filters/BlurIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { ReactElement } from "react";

export function BlurIcon(): ReactElement {
return (
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M0 0h24v24H0z" fill="none" />
<path d="M6 13c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-8c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm-3 .5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM6 5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm15 5.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM14 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0-3.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zm-11 10c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm7 7c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm0-17c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM10 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0 5.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm8 .5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-8c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm3 8.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM14 17c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 3.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm-4-12c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0 8.5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm4-4.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-4c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z" />
</svg>
);
}
21 changes: 21 additions & 0 deletions src/components/icons/filters/ContrastIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { ReactElement } from "react";

export function ContrastIcon(): ReactElement {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
enableBackground="new 0 0 24 24"
height="24px"
viewBox="0 0 24 24"
width="24px"
fill="currentColor"
>
<g>
<rect fill="none" height="24" width="24" />
</g>
<g>
<path d="M12,22c5.52,0,10-4.48,10-10S17.52,2,12,2S2,6.48,2,12S6.48,22,12,22z M13,4.07c3.94,0.49,7,3.85,7,7.93s-3.05,7.44-7,7.93 V4.07z" />
</g>
</svg>
);
}
21 changes: 21 additions & 0 deletions src/components/icons/filters/DropletIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { ReactElement } from "react";

export function DropletIcon(): ReactElement {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
enableBackground="new 0 0 24 24"
height="24px"
viewBox="0 0 24 24"
width="24px"
fill="currentColor"
>
<g>
<path d="M0,0h24v24H0V0z" fill="none" />
</g>
<g>
<path d="M12,4.81L12,19c-3.31,0-6-2.63-6-5.87c0-1.56,0.62-3.03,1.75-4.14L12,4.81 M6.35,7.56L6.35,7.56C4.9,8.99,4,10.96,4,13.13 C4,17.48,7.58,21,12,21c4.42,0,8-3.52,8-7.87c0-2.17-0.9-4.14-2.35-5.57l0,0L12,2L6.35,7.56z" />
</g>
</svg>
);
}
10 changes: 10 additions & 0 deletions src/components/icons/filters/PixelateIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { ReactElement } from "react";

export function PixelateIcon(): ReactElement {
return (
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M0 0h24v24H0z" fill="none" />
<path d="M11 9h2v2h-2zm-2 2h2v2H9zm4 0h2v2h-2zm2-2h2v2h-2zM7 9h2v2H7zm12-6H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 18H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm2-7h-2v2h2v2h-2v-2h-2v2h-2v-2h-2v2H9v-2H7v2H5v-2h2v-2H5V5h14v6z" />
</svg>
);
}
28 changes: 28 additions & 0 deletions src/components/icons/filters/SunDimIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { ReactElement } from "react";

export function SunDimIcon(): ReactElement {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="lucide lucide-sun-dim"
>
<circle cx="12" cy="12" r="4" />
<path d="M12 4h.01" />
<path d="M20 12h.01" />
<path d="M12 20h.01" />
<path d="M4 12h.01" />
<path d="M17.657 6.343h.01" />
<path d="M17.657 17.657h.01" />
<path d="M6.343 17.657h.01" />
<path d="M6.343 6.343h.01" />
</svg>
);
}
28 changes: 28 additions & 0 deletions src/components/icons/filters/SunHighIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { ReactElement } from "react";

export function SunHighIcon(): ReactElement {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="lucide lucide-sun"
>
<circle cx="12" cy="12" r="4" />
<path d="M12 2v2" />
<path d="M12 20v2" />
<path d="m4.93 4.93 1.41 1.41" />
<path d="m17.66 17.66 1.41 1.41" />
<path d="M2 12h2" />
<path d="M20 12h2" />
<path d="m6.34 17.66-1.41 1.41" />
<path d="m19.07 4.93-1.41 1.41" />
</svg>
);
}
4 changes: 2 additions & 2 deletions src/components/layout/BasicLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ReactElement, ReactNode } from "react";
import clsx from "clsx";
import { GithubIcon } from "~/components/icons/GithubIcon";
import { LinkedInIcon } from "~/components/icons/LinkedInIcon";
import { GithubIcon } from "~/components/icons/social/GithubIcon";
import { LinkedInIcon } from "~/components/icons/social/LinkedInIcon";

export interface SocialLinkProps {
onGithubClick?: () => void;
Expand Down
24 changes: 24 additions & 0 deletions src/components/library/editor/atoms/filters/FilterAtoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export const blurFilterAtom = atom(0);
export const brightnessFilterAtom = atom(1);
export const contrastFilterAtom = atom(1);
export const saturationFilterAtom = atom(1);
export const pixelateFilterAtom = atom(0);
export const redFilterAtom = atom(1);
export const greenFilterAtom = atom(1);
export const blueFilterAtom = atom(1);

// Derived
export const controlFilterAtom = atom(
Expand All @@ -13,12 +17,20 @@ export const controlFilterAtom = atom(
const brightness = get(brightnessFilterAtom);
const contrast = get(contrastFilterAtom);
const saturation = get(saturationFilterAtom);
const pixelate = get(pixelateFilterAtom);
const red = get(redFilterAtom);
const green = get(greenFilterAtom);
const blue = get(blueFilterAtom);

return {
blur,
brightness,
contrast,
saturation,
pixelate,
red,
green,
blue,
};
},
(_get, set, update: Partial<StagedFilter>) => {
Expand All @@ -34,5 +46,17 @@ export const controlFilterAtom = atom(
if (update.saturation !== undefined) {
set(saturationFilterAtom, update.saturation);
}
if (update.pixelate !== undefined) {
set(pixelateFilterAtom, update.pixelate);
}
if (update.red !== undefined) {
set(redFilterAtom, update.red);
}
if (update.green !== undefined) {
set(greenFilterAtom, update.green);
}
if (update.blue !== undefined) {
set(blueFilterAtom, update.blue);
}
}
);
4 changes: 4 additions & 0 deletions src/components/library/editor/drawer/FilterDrawer.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const commonProps = {
brightness: 1,
contrast: 1,
saturation: 1,
pixelate: 0,
red: 0,
green: 0,
blue: 0,
onFilterChange: () => console.log("onFilterChange"),
onClose: () => console.log("onClose"),
} satisfies ComponentProps;
Expand Down
Loading
Loading