From ea57f92b901629fa1b3df8b111469b7ed888b5e9 Mon Sep 17 00:00:00 2001 From: Lanskikh Date: Thu, 11 Jul 2024 14:57:47 +0500 Subject: [PATCH] added skolkovo logo and popup --- .gitignore | 2 + .prettierrc | 7 ++ .vscode/settings.json | 4 + package.json | 1 + src/Projects/Projects.tsx | 2 +- src/app/page.tsx | 2 + src/components/Header.tsx | 24 +++++- src/components/Showreel.tsx | 15 ++-- src/components/icons/SkolkovoIcon.tsx | 105 ++++++++++++++++++++++++++ src/components/modals/Popup.tsx | 59 +++++++++++++++ src/stores/useIsPopupShowed.ts | 31 ++++++++ src/stores/useModalStore.ts | 5 +- src/stores/usePopupClosed.ts | 0 yarn.lock | 26 ++++++- 14 files changed, 268 insertions(+), 15 deletions(-) create mode 100644 .prettierrc create mode 100644 .vscode/settings.json create mode 100644 src/components/icons/SkolkovoIcon.tsx create mode 100644 src/components/modals/Popup.tsx create mode 100644 src/stores/useIsPopupShowed.ts create mode 100644 src/stores/usePopupClosed.ts diff --git a/.gitignore b/.gitignore index a92686d..4cd9a69 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +/.vs_code \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..3f73b0e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "arrowParens": "avoid", + "semi": true, + "singleQuote": false, + "trailingComma": "all", + "tabWidth": 2 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..aefc6fe --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "prettier.configPath": "./.prettierrc", + "prettier.prettierPath": "./node_modules/prettier" +} \ No newline at end of file diff --git a/package.json b/package.json index d64c78d..b4aff22 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.6", "postcss": "^8", + "prettier": "^3.3.2", "tailwindcss": "^3.3.0", "typescript": "^5" } diff --git a/src/Projects/Projects.tsx b/src/Projects/Projects.tsx index 631caf6..198d2f7 100644 --- a/src/Projects/Projects.tsx +++ b/src/Projects/Projects.tsx @@ -34,7 +34,7 @@ const Projects = () => { }, []); return ( -
+
Проекты +
diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 8dcb885..6644454 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -3,15 +3,17 @@ import useModalStore from "@stores/useModalStore"; import Button from "./Button"; import FeedbackModal from "./modals/FeedbackModal"; +import Link from "next/link"; /* eslint-disable @next/next/no-img-element */ const Header = () => { - const [setModal] = useModalStore((state) => [state.setModal]); + const setModal = useModalStore(state => state.setModal); const handleOnBtnClick = () => setModal(); + return (
-
-
+
+
{ className="sm:hidden block" />
-
+
+ + Блог + + + Проекты + +
+
+
+ + )} + + ); +} + +export default Popup; diff --git a/src/stores/useIsPopupShowed.ts b/src/stores/useIsPopupShowed.ts new file mode 100644 index 0000000..9921ed8 --- /dev/null +++ b/src/stores/useIsPopupShowed.ts @@ -0,0 +1,31 @@ +import { stat } from "fs"; +import { create } from "zustand"; +import { persist } from "zustand/middleware"; + +export const useIsPopupShowed = create<{ + isPopupShowed: boolean; + setIsPopupShowed: (isPopupShowed: boolean) => void; +}>(set => ({ + isPopupShowed: false, + setIsPopupShowed: (isPopupShowed: boolean) => set({ isPopupShowed }), +})); + +export const useClosePopup = create<{ + closed: boolean; + close: () => void; +}>()( + persist( + set => ({ + closed: + JSON.parse(localStorage.getItem("closing") ?? "{}").state ?? false, + close: () => { + localStorage.setItem( + "closing", + JSON.stringify({ state: { closed: true } }), + ); + set({ closed: true }); + }, + }), + { name: "closing", partialize: state => ({ closed: state.closed }) }, + ), +); diff --git a/src/stores/useModalStore.ts b/src/stores/useModalStore.ts index 82f2430..971e260 100644 --- a/src/stores/useModalStore.ts +++ b/src/stores/useModalStore.ts @@ -1,3 +1,4 @@ +import Popup from "@components/modals/Popup"; import { ReactNode } from "react"; import { create } from "zustand"; @@ -6,9 +7,9 @@ interface ModalState { setModal: (modal: ReactNode) => void; } -const useModalStore = create((set) => ({ +const useModalStore = create(set => ({ modal: null, - setModal: (modal) => set({ modal }), + setModal: modal => set({ modal }), })); export default useModalStore; diff --git a/src/stores/usePopupClosed.ts b/src/stores/usePopupClosed.ts new file mode 100644 index 0000000..e69de29 diff --git a/yarn.lock b/yarn.lock index 8bfc4f5..8cdd257 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2440,6 +2440,11 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== +prettier@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.2.tgz#03ff86dc7c835f2d2559ee76876a3914cec4a90a" + integrity sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA== + prop-types@^15.6.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" @@ -2723,8 +2728,16 @@ streamsearch@^1.1.0: resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: - name string-width-cjs +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -2785,7 +2798,14 @@ string.prototype.trimstart@^1.0.7: define-properties "^1.2.0" es-abstract "^1.22.1" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==