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
App.jsx: | |
import { useState } from 'react'; | |
import './App.css'; | |
function App() { | |
const [activeSection, setActiveSection] = useState('home'); | |
// обработка плавной прокрутки | |
const handleNavClick = (e, targetId) => { |
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
App.jsx: | |
import {useState} from 'react'; | |
import { | |
Navbar, | |
Nav, | |
Container, | |
Button, | |
Carousel, | |
Card, |
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
App.scss: | |
// --------------------------------------------------------------- | |
// переменные | |
$primary-color: #3498db; | |
$secondary-color: #2ecc71; | |
$font-stack: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
$themes: dark, light, neutral; | |
// --------------------------------------------------------------- |
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
App.sass: | |
// --------------------------------------------------------------- | |
// переменные | |
$primary-color: #3498db | |
$secondary-color: #2ecc71 | |
$font-stack: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif | |
$themes: dark, light, neutral | |
// --------------------------------------------------------------- |
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
App.less: | |
// переменные | |
@primary-color: #007acc; | |
@secondary-color: lighten(@primary-color, 20%); | |
@text-color: #fff; | |
@padding: 16px; | |
// миксин (переиспользуемый блок), что-то вроде функции | |
.box-shadow(@color) { |
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
файл стилей Button.css: | |
.button { | |
background-color: #00cc99; | |
color: white; | |
padding: 8px 16px; | |
border: none; | |
border-radius: 4px; | |
} |
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
файл стилей Button.module.css: | |
в названии файла конечно не обязательно использовать расширение .module для работы с CSS-модулями, | |
но! это общепринятая конвенция в React и других фреймворках (например, Next.js), | |
которая помогает инструментарию (например, Webpack, Vite) распознать файл как CSS-модуль. | |
если название содержит .module.css, система автоматически генерирует уникальные имена классов, и импортирует стили как объект JavaScript | |
без .module (например, просто .css) файл будет рассматриваться как обычный CSS-файл с глобальными стилями, | |
если не настроен специальный плагин или конфигурация! |
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
function Greeting() { | |
const styles = { | |
color: 'blue', | |
backgroundColor: 'lightgray', | |
padding: '10px', | |
borderRadius: '5px', | |
}; | |
return <div style={styles}>Привет, мир!</div>; | |
} |
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
App.jsx: | |
import React, { useState, useEffect } from 'react'; | |
import './App.css'; | |
function App() { | |
const [isLoggedIn, setIsLoggedIn] = useState(false); // начальное состояние авторизации | |
const [isReady, setIsReady] = useState(false); // состояние готовности компонента | |
// имитация загрузки данных, тут может быть прелоадер |
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
src / components / List.jsx: | |
import React from 'react'; | |
// компонента для одного элемента списка | |
function ListItem({ person }) { | |
return ( | |
<li> | |
{person.firstName} {person.lastName} - {person.phoneNumber} | |
</li> |
NewerOlder