Skip to content

Commit

Permalink
Add CSS modules experiment
Browse files Browse the repository at this point in the history
This would potentially replace Linaria
  • Loading branch information
aeharding committed Nov 15, 2024
1 parent a93a52b commit 8f53161
Show file tree
Hide file tree
Showing 11 changed files with 218 additions and 100 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"typescript": "^5.6.3",
"typescript-eslint": "^8.13.0",
"vite": "^5.4.10",
"vite-css-modules": "^1.5.2",
"vite-plugin-pwa": "^0.20.5",
"vite-plugin-svgr": "^4.3.0",
"vite-tsconfig-paths": "^5.1.2",
Expand Down
118 changes: 118 additions & 0 deletions pnpm-lock.yaml

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

9 changes: 2 additions & 7 deletions src/features/post/shared/SaveButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ImpactStyle } from "@capacitor/haptics";
import { IonIcon } from "@ionic/react";
import { css } from "@linaria/core";
import { bookmarkOutline } from "ionicons/icons";
import { PostView } from "lemmy-js-client";
import { MouseEvent, useContext } from "react";
Expand All @@ -13,11 +12,7 @@ import useHapticFeedback from "#/helpers/useHapticFeedback";
import { useAppDispatch, useAppSelector } from "#/store";

import { savePost } from "../postSlice";

const savedButtonCss = css`
background: var(--ion-color-success);
color: var(--ion-color-primary-contrast);
`;
import styles from "./saveButton.module.css";

interface SaveButtonProps {
post: PostView;
Expand Down Expand Up @@ -52,7 +47,7 @@ export function SaveButton({ post }: SaveButtonProps) {

return (
<ActionButton
className={mySaved ? savedButtonCss : undefined}
className={mySaved ? styles.button : undefined}
onClick={onSavePost}
>
<IonIcon icon={bookmarkOutline} />
Expand Down
Loading

0 comments on commit 8f53161

Please sign in to comment.