Tailwind - flex
flex λ Container μ item μ λ°°μΉνλ λ°©λ²μ μ§μ νμ¬ μ μ°ν λ μ΄μμμ μ μ©μν€λ λ μ΄μμμ
λλ€.
β’
컨ν
μ΄λ : λ°°μΉν UI μμλ₯Ό λ΄λ λ°μ€
β’
μμ΄ν
: λ°°μΉ λ° μ λ ¬ν μμ
tailwind μμλ flex ν΄λμ€λ₯Ό μ μ©νμ¬, νΉμ μμλ₯Ό flex 컨ν
μ΄λλ₯Ό μ§μ ν μ μμ΅λλ€.
FLEX μΉ΄λλ·° λ μ΄μμ
import React from 'react';
import MainLayout from '../../layouts/MainLayout';
const SkeletonCard = () => {
return (
<div className="m-10 inline-block w-[320px]">
<div className="bg-gray-200 p-4 rounded-lg shadow-md space-y-4 animate-pulse">
<div className="h-60 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div>
<div className="space-y-2">
<div className="h-4 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div>
<div className="h-4 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div>
<div className="h-4 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div>
<div className="h-4 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div>
<div className="h-4 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div>
</div>
</div>
</div>
);
};
const Flex = () => {
return (
<MainLayout>
<div className="flex flex-wrap justify-center p-10">
<SkeletonCard />
<SkeletonCard />
<SkeletonCard />
<SkeletonCard />
<SkeletonCard />
<SkeletonCard />
<SkeletonCard />
<SkeletonCard />
</div>
</MainLayout>
);
};
export default Flex;
JavaScript
볡μ¬
flex λ μ΄μμμ ν€λ, μΉ΄λλ·°, λ± λ€μν UI λ μ΄μμμ μ¬μ©λ©λλ€.
FLEX ν€λ
import React from 'react';
import { Link } from 'react-router-dom';
const Header = () => {
return (
<header className="bg-gray-800 text-white p-4">
<div className="container mx-auto flex justify-between items-center">
<Link to="/"><h1 className="text-xl font-bold">ALOHA CLASS</h1></Link>
<nav>
<Link to="/" className="mx-2 hover:underline">Home</Link>
<Link to="/login" className="mx-2 hover:underline">Login</Link>
<Link to="/margin" className="mx-2 hover:underline">Margin</Link>
<Link to="/padding" className="mx-2 hover:underline">Padding</Link>
<Link to="/border" className="mx-2 hover:underline">Border</Link>
<Link to="/flex" className="mx-2 hover:underline">Flex</Link>
</nav>
</div>
</header>
);
};
export default Header;
JavaScript
볡μ¬