#9. ์ดˆํ™”๋ฉด ๋””์ž์ธ ( CSS ์ ์šฉ ๋ฐ ํ™”๋ฉด Component์ œ์ž‘ )

 

#9. ์ดˆํ™”๋ฉด ๋””์ž์ธ ( CSS ์ ์šฉ ๋ฐ ํ™”๋ฉด Component์ œ์ž‘ )

#8. ํ”„๋ก ํŠธ์—”๋“œ ํ™”๋ฉด๊ฐœ๋ฐœ (component ์ œ์ž‘) #8. ํ”„๋ก ํŠธ์—”๋“œ ํ™”๋ฉด๊ฐœ๋ฐœ (component ์ œ์ž‘) #7. ํ”„๋ก ํŠธ์—”๋“œ ํ™”๋ฉด ๊ฐœ๋ฐœ #7. ํ”„๋ก ํŠธ์—”๋“œ ํ™”๋ฉด ๊ฐœ๋ฐœ 1. React๋กœ ํ™”๋ฉด ๊ฐœ๋ฐœ ์ž, ์ด์ œ๋ถ€ํ„ฐ REACT๋กœ ํ™”๋ฉด์„ ๊ฐœ๋ฐœ ํ•ด๋ณด์ž. ์•ž

firstvalue.tistory.com

์ง€๊ธˆ๊นŒ์ง€ Pytho Flask Restful API ์™€ React ๋กœ ๋งํฌ์„œ๋น„์Šค์˜ ์ดˆํ™”๋ฉด์„ ์ œ์ž‘ํ–ˆ๋‹ค.

์•ž์œผ๋กœ ํ• ์ผ์„ ์ •๋ฆฌํ•ด์„œ ํ•˜๋‚˜์”ฉ ์ง„ํ–‰ํ•ด ๋ณด๊ธฐ๋กœ ํ•œ๋‹ค.

 

โŽŸโŽœTO-DO

-       ๋“ฑ๋กํ™”๋ฉด/ํŽธ์ง‘ํ™”๋ฉด ์ œ์ž‘ ( ์ด๋ฏธ์ง€ ๋“ฑ๋ก ํฌํ•จ )

-       ์ƒ๋‹จ์— ์ปค๋ฒ„ ์ด๋ฏธ์ง€ ์ถ”๊ฐ€ ( ์ปค๋ฒ„ ์ด๋ฏธ์ง€ ๋ณ€๊ฒฝ ํฌํ•จ )

-       ์ปค๋ฒ„ ์ด๋ฏธ์ง€ ๊ตฌ๊ฐ„์— ์ผ์ •์„ ํ‘œ์‹œ ( ์ผ์ •๊ด€๋ฆฌ CRUDํฌํ•จ )

-       Drag&Drop์œผ๋กœ ๋งํฌ ๋ฆฌ์ŠคํŠธ ์ˆœ์„œ ๋ณ€๊ฒฝ ( ๋ชจ๋ฐ”์ผ์—์„œ๋Š” Touch )

-       ํƒœ๊ทธ ํด๋ผ์šฐ๋“œ ํ‘œ์‹œ ( CRUD๋Š” ์ œ์™ธ)

-       ๋กœ๊ทธ์ธ ์ฒ˜๋ฆฌ ( ํšŒ์›๊ฐ€์ž…๋ถ€๋ถ„์€ ์ œ์™ธ )

-       ๊ตฌ๊ธ€์• ๋„๋ฆฌํ‹ฑ์Šค(Google Analytics)์™€ ์—ฐ๊ฒฐ

 

1.1. ๋“ฑ๋กํ™”๋ฉด ์ œ์ž‘

 

โŒ˜ links.create.jsx ( ์œ„์น˜: linkservice/client/src/component/links.create.jsx)

---------------------------------------------------------------------------------------------------

๊ธฐ๋ณธ์ ์ธ ๋“ฑ๋ก ํ•ญ๋ชฉ์„ ๋งŒ๋“ ๋‹ค. ( LinkCreateMain )

import React from "react";

export default function LinkCreateMain() {
  return (
<>
    <div>
        <h1>๋งํฌ ๋“ฑ๋ก</h1>
    </div>
    <div><label>๋งํฌ๋ช…</label></div>
    <div><input type="text" name="name" /></div>
    <div><label>ํƒœ๊ทธ์ •๋ณด ( ํƒœ๊ทธ ์—ฌ๋Ÿฌ๊ฐœ ๋“ฑ๋ก์‹œ / ๋กœ ๊ตฌ๋ถ„ )</label></div>
    <div><input type="text" name="tag" /></div>
    <div><label>๋งํฌ URL (์—ฐ๊ฒฐํ•˜๊ณ ์ž ํ•˜๋Š” URL)</label></div>
    <div><input type="text" name="linkurl" /></div>
    <div><label>์‚ฌ์ง„ ๋งํฌ ์ •๋ณด</label></div>
    <div><input type="text" name="imageurl" /></div>

    <div><button type="submit">๋“ฑ๋ก</button></div>
</>
  )
}

โŒ˜ App.js์—์„œ ์ถ”๊ฐ€์ ์œผ๋กœ Route์„ ์ง€์ •ํ•œ๋‹ค.

 

App.js ์— LinkCreateMain ์˜ Route์„ ์ง€์ •ํ•œ๋‹ค.

App.js์— Route์ถ”๊ฐ€ ํ›„ http://localhost:3000/create ๋กœ ์ ‘์†ํ•ด๋ณด์ž.

 

http://localhost:3000/create

๊ทธ๋ž˜๋„ input box์— ๋Œ€ํ•œ ๋””์ž์ธ๊ณผ ์‚ฌ์ง„์„ ์ง์ ‘(PC) ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๋„๋ก ๋“ฑ๋กํ™”๋ฉด์„ ์ข€ ๊ฐœ์„ ํ•ด ๋ณด๊ฒ ๋‹ค.

 

CSS์— ์•„๋ž˜ ๋‚ด์šฉ์„ ์ถ”๊ฐ€ํ•œ๋‹ค. ( links.css ) 

.title-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.text-title {
    text-align: center;
    font-size: 18px;
}
.input-wrap {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    margin-bottom: 20px;
}
.input-wrap > label {
    margin-bottom: 5px;
    font-size: 14px;
}
.input-box {
    height: 40px;
    width: 100%;
    position: relative;
}
.input-css {
    height: 44px;
    font-size: 14px;
    padding: 14px 12px;
    width: 100%;
    margin: 3px;
    box-sizing: border-box;
    color: #343434;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    background-color: bisque;
}

์•„๋ž˜์™€ ๊ฐ™์€ ๋งํฌ๋ช…๊ณผ ๊ฐ™์ด input-wrap ์•ˆ์œผ๋กœ ๋‹ค๋ฅธ ํ•ญ๋ชฉ๋“ค๋„ ๋ชจ๋‘ ์ž‘์„ฑํ•œ๋‹ค.

input-wrap > input-box > input-css ์„ ๊ฐ ํ•ญ๋ชฉ์— ์ˆœ์ฐจ์ ์œผ๋กœ ์ ์šฉ

input-wrap > input-box > input-css ์„ ๊ฐ ํ•ญ๋ชฉ์— ์ˆœ์ฐจ์ ์œผ๋กœ ์ ์šฉ

์ผ๋ฐ˜ INPUT BOX๋Š” ์œ„์™€ ๊ฐ™์ด ์ ์šฉํ•˜๋ฉด ๋˜๋‚˜, ์ด๋ฏธ์ง€ ๋ถ€๋ถ„์€ PC์— ์žˆ๋Š” ์ด๋ฏธ์ง€๋ฅผ ์ง์ ‘ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๊ฒŒ ๊ธฐ๋Šฅ์„ ๋ถ€์—ฌํ•˜๊ธฐ ์œ„ํ•ด์„œ ์•„๋ž˜ ๋ถ€๋ถ„์„ ์ถ”๊ฐ€์ ์œผ๋กœ ๋ฐ˜์˜ํ•œ๋‹ค.

.img_contain {
    display: flex;
margin-top: 10px;
    margin-bottom: 20px;
}
.img_wrap {
    display: flex;
    width: 50%;
 }
.img_box {
    align-items: center;
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    background-position: 50%;
    background-repeat: no-repeat;
    background-size: cover;
    background-color: gray;
    cursor: pointer;
}
.text_type {
    display: flex;
    align-items: flex-end;
    margin-left: 10px;
  }

links.create.jsx์— ์ด๋ฏธ์ง€๋ฅผ ์ง์ ‘๋“ฑ๋กํ•˜๋Š” ๋ถ€๋ถ„์„ ์ถ”๊ฐ€

http://localhost:3000/create ๋กœ ํ™•์ธํ•ด๋ณด์ž.

 

๋งํฌ์„œ๋น„์Šค ๋“ฑ๋กํ™”๋ฉด

๋””์ž์ธ์ด ์–ด๋ ต๋‹ค๋ฉด bootstrap์— ์ œ๊ณต๋˜๋Š” form styles์„ ํ™œ์šฉํ•ด๋„ ๋œ๋‹ค

์ฐธ๊ณ  : https://getbootstrap.com/docs/4.0/components/forms/

 

โŽŸโŽœ๋””์ž์ธ ๋ถ€๋ถ„์€ ์ด์ •๋„๋กœ ๋๋‚ด๊ณ  ๋‹ค์Œ์—๋Š” ๊ธฐ๋Šฅ ๊ตฌํ˜„์„ ํ•ด๋ณด์ž.

 


 

+ Recent posts