Skip to content

homework-2#2

Open
W0x3R wants to merge 44 commits into
mainfrom
homework-2
Open

homework-2#2
W0x3R wants to merge 44 commits into
mainfrom
homework-2

Conversation

@W0x3R
Copy link
Copy Markdown
Owner

@W0x3R W0x3R commented Aug 8, 2025

1) Реализован ThemeContext и функционал для переключения темы приложения:

  • Добавлен ThemeProvider.
  • Добавлен пользовательский хук useTheme.
  • Добавлен компонент ThemeSwitcher и стили для него.
  • Реализовано изменение иконки переключения темы согласно активной цветовой схеме приложения.

2) Использован React.Fragment и key в функционале создания постов.

3) Реализован функционал открытия/закрытия модального окна "О проекте" через React.Portal с блокировкой скрола и стили для него.

4) Создан компонент Button и стили для него для обработки событий.

W0x3R added 30 commits August 4, 2025 22:34
…locks with wrapper class (Tue, Aug 5, 2025, 5:15:33 PM)
… with a description of the project. the functionality of opening/closing the modal window has been implemented
…ader have been added. (Fri, Aug 8, 2025, 4:46:46 PM)
…been created. (Fri, Aug 8, 2025, 4:50:12 PM)
Comment thread src/app/App.tsx Outdated
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])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему классы "dark" и "light" не положил в GLOBAL_CLASSES, раз уж используешь общий обьект для классов?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Слой features нужно вынести в src

export const ThemeSwitcher = () => {
const { theme, toggleTheme } = useContext(ThemeContext)
return (
<button className={styles["toggle__theme-btn"]} onClick={toggleTheme}>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не особо вижу смысла использовать методологию БЭМ, так как благодаря модульным стилям уже есть изоляция. Разве что — в совсем крупных компонентах, хотя мне трудно такой представить. Но это так, на подумать

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Константам тут не место, нужно перенести в shared/constants

Comment thread src/widgets/LayoutHeader/Header.tsx Outdated
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"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Импортировать из app в widgets — плохая практика. Нужно вынести слой features из app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants