๐Ÿ’ป My Work/๐ŸŽจ Material Design

[Material Design] Material-UI(MUI)๋กœ react & styled component ์‚ฌ์šฉํ•˜๊ธฐ <ํŠน์ • ๊ธธ์ด ๋„˜์–ด๊ฐ€๋ฉด ...>

Jaeseo Kim 2022. 10. 5. 23:51

https://mui.com/system/display/

 

Display - MUI System

Quickly and responsively toggle the display value of components and more with the display utilities. Includes support for some of the more common values, as well as some extras for controlling display when printing.

mui.com

 

์ œ๋ชฉ ์“ฐ๊ณ ๋‚˜์„œ ๋ณด๋‹ˆ, ๋ง์„ ํ•˜๋‹ค ๋งŒ ๊ฒƒ ๊ฐ™์•„์„œ ์ข€ ์›ƒ๊ธฐ๋‹ค. (๋ง˜์— ๋“ ๋‹ค.)

 

์ด๋ฏธ์ง€ ์ถœ์ฒ˜ MUI ๊ณต์‹ ๋ฌธ์„œ

์œ„์™€ ๊ฐ™์€ ์‹์œผ๋กœ!! ์ผ์ • ๊ธธ์ด๋ฅผ ๋„˜์œผ๋ฉด ... ์œผ๋กœ ์ƒ๋žต ๋˜๋Š” ๊ฑธ ๋งŽ์ด ๋ณด์…จ์„ ๊ฑฐ์—์š”!

์ด๊ฑธ ๊ตฌํ˜„ํ• ๊ฒŒ์š”!

 

 

00. Text overflow : "ellipsis", overflow : "hidden"


์˜ˆ์‹œ๋กœ, width๊ฐ€ 200px์ธ Box ์•ˆ์— ์ผ์ • ๊ธธ์ด ๋„˜์–ด๊ฐ€๋ฉด ์ƒ๋žต ๋˜๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.

import { Box, Typography } from "@mui/material";

...

	<Box
            sx={{
              width: "200px",
              whiteSpace: "nowrap",
              bgcolor: "grey.500"
            }}
          >
            <Typography
              sx={{
                textOverflow: "ellipsis",
                overflow: "hidden"
              }}
              variant="h3"
            >
              Lorem Ipsum is simply dummy text
            </Typography>
	</Box>

 

 

์œ„์˜ ์˜ˆ์‹œ์ฒ˜๋Ÿผ, ๊ณ ์ •๋œ ๊ธธ์ด์—์„œ๋„ ๋˜์ง€๋งŒ ๋ฐ˜์‘ํ˜•์œผ๋กœ๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค!

	<Box
            sx={{
              width: 1,
              whiteSpace: "nowrap",
              bgcolor: "grey.500"
            }}
          >
            <Typography
              sx={{
                textOverflow: "ellipsis",
                overflow: "hidden"
              }}
              variant="h3"
            >
              Lorem Ipsum is simply dummy text
            </Typography>
	</Box>

์œ„ ์˜ˆ์‹œ ์ฝ”๋“œ์—์„œ width : 1 ๋กœ ์ˆ˜์ •ํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

width : 1 ์€ width : 100% ์™€๋„ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๐Ÿ˜‰

 

์งœ๋ผ๋ž€ ๐ŸŒž๐ŸŒž