====== Стилі (react) ====== ===== 1 Вбудовані стиілі ===== // src/components/App.jsx export const App = () => { return (

Please update your email!

); };
// src/components/App.jsx const alertStyles = { margin: 8, padding: "12px 16px", borderRadius: 4, backgroundColor: "gray", color: "white", }; export const App = () => { return ( <>

Please update your email!

There was an error during transaction!

Payment received, thank you for your purchase!

); };
===== 2 Динамічні стилі ===== щоб залежно від типу оповіщення, у компоненті Alert змінювався колір фону абзацу. Для цього додамо йому обов'язковий пропс variant з кількома можливими значеннями. // src/components/App.jsx import { Alert } from "./Alert"; const App = () => { return ( <> Would you like to browse our recommended products? There was an error during your last transaction Payment received, thank you for your purchase Please update your profile contact information ); }; ===== 3 Модульні стилі (правильний метод) ===== - У тій же теці де сам модуль, кладемо і файл з стилямии - Якщо модуль зветься FriendListItem.jsx то файл повинн зватись FriendListItem.module import css from "../FriendListItem/FriendListItem.module.css"; const FriendListItem = ({avatar, name, isOnline}) => { return (
  • Avatar

    {name}

    {isOnline===true?(

    true

    ):(

    false

    )}
  • ) } export default FriendListItem
    .FriendListItem { list-style: none; border: 2px solid black; padding: 15px 15px; border-radius: 5px; justify-content: center; justify-items: center; align-items: center; text-align: center; } .FriendListItemName{ font-size: x-large; margin: 0; } .FriendListItemOnline{ font-size: larger; color: green; margin: 0; } .FriendListItemOffline{ font-size: larger; color: red; margin: 0; }