homework-2#2
Open
W0x3R wants to merge 44 commits into
Open
Conversation
…locks with wrapper class (Tue, Aug 5, 2025, 5:15:33 PM)
…e, Aug 5, 2025, 5:18:44 PM)
… with a description of the project. the functionality of opening/closing the modal window has been implemented
…modal window controls has been changed
…ader have been added. (Fri, Aug 8, 2025, 4:46:46 PM)
…been created. (Fri, Aug 8, 2025, 4:50:12 PM)
Comment on lines
+9
to
+16
| const [theme, setTheme] = useState("light") | ||
|
|
||
| const toggleTheme = () => setTheme(theme === "light" ? "dark" : "light") | ||
|
|
||
| useEffect(() => { | ||
| document.body.classList.remove("light", "dark") | ||
| document.body.classList.add(theme) | ||
| }, [theme]) |
There was a problem hiding this comment.
А почему классы "dark" и "light" не положил в GLOBAL_CLASSES, раз уж используешь общий обьект для классов?
There was a problem hiding this comment.
Слой features нужно вынести в src
| export const ThemeSwitcher = () => { | ||
| const { theme, toggleTheme } = useContext(ThemeContext) | ||
| return ( | ||
| <button className={styles["toggle__theme-btn"]} onClick={toggleTheme}> |
There was a problem hiding this comment.
Не особо вижу смысла использовать методологию БЭМ, так как благодаря модульным стилям уже есть изоляция. Разве что — в совсем крупных компонентах, хотя мне трудно такой представить. Но это так, на подумать
There was a problem hiding this comment.
Константам тут не место, нужно перенести в shared/constants
| import HeaderLogo from "../../shared/assets/images/logo.svg?react" | ||
| import { controlBodyScroll } from "../../shared/lib/controlBodyScroll" | ||
| import { GLOBAL_CLASSES } from "../../app/styles/globalClasses.js" | ||
| import { ThemeSwitcher } from "../../app/features/ThemeSwitcher/ui/ThemeSwitcher.js" |
There was a problem hiding this comment.
Импортировать из app в widgets — плохая практика. Нужно вынести слой features из app
… component together with styles
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1) Реализован ThemeContext и функционал для переключения темы приложения:
2) Использован React.Fragment и key в функционале создания постов.
3) Реализован функционал открытия/закрытия модального окна "О проекте" через React.Portal с блокировкой скрола и стили для него.
4) Создан компонент Button и стили для него для обработки событий.