diff --git "a/3\354\243\274\354\260\250-NextJS/next-sns/components/Avatar.jsx" "b/3\354\243\274\354\260\250-NextJS/next-sns/components/Avatar.jsx" index 55097e5..1f02873 100644 --- "a/3\354\243\274\354\260\250-NextJS/next-sns/components/Avatar.jsx" +++ "b/3\354\243\274\354\260\250-NextJS/next-sns/components/Avatar.jsx" @@ -1,11 +1,11 @@ -import React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; -import Avatar from '@material-ui/core/Avatar'; +import React from "react"; +import { makeStyles } from "@material-ui/core/styles"; +import Avatar from "@material-ui/core/Avatar"; const useStyles = makeStyles((theme) => ({ root: { - display: 'flex', - '& > *': { + display: "flex", + "& > *": { margin: theme.spacing(1), }, }, @@ -13,22 +13,39 @@ const useStyles = makeStyles((theme) => ({ width: theme.spacing(3), height: theme.spacing(3), }, + medium: { + width: theme.spacing(7), + height: theme.spacing(7), + }, large: { width: theme.spacing(13), height: theme.spacing(13), }, })); -export default function ImageAvatars() { +export default function ImageAvatars({ size }) { const classes = useStyles(); - return (
- + {size === 0 ? ( + + ) : size === 1 ? ( + + ) : ( + + )}
); } diff --git "a/3\354\243\274\354\260\250-NextJS/next-sns/components/Comment.jsx" "b/3\354\243\274\354\260\250-NextJS/next-sns/components/Comment.jsx" new file mode 100644 index 0000000..28cf716 --- /dev/null +++ "b/3\354\243\274\354\260\250-NextJS/next-sns/components/Comment.jsx" @@ -0,0 +1,21 @@ +import React from "react"; +import Avatar from "../components/Avatar"; +import { Divider, Grid } from "@material-ui/core"; + +export default function Comment({ data }) { + const { username, comment } = data; + return ( + <> + + + + + +

{username}

+

{comment}

+
+
+ + + ); +} diff --git "a/3\354\243\274\354\260\250-NextJS/next-sns/components/Feed.jsx" "b/3\354\243\274\354\260\250-NextJS/next-sns/components/Feed.jsx" new file mode 100644 index 0000000..4860f9b --- /dev/null +++ "b/3\354\243\274\354\260\250-NextJS/next-sns/components/Feed.jsx" @@ -0,0 +1,162 @@ +import React from "react"; +import Link from "next/link"; +import Avatar from "./Avatar"; +import Comment from "./Comment"; +import { + Paper, + TextField, + Grid, + CardHeader, + CardMedia, + CardContent, + Card, + CardActions, + Collapse, + IconButton, + Typography, + makeStyles, +} from "@material-ui/core"; +import SendIcon from "@material-ui/icons/Send"; +import FavoriteIcon from "@material-ui/icons/Favorite"; +import ChatIcon from "@material-ui/icons/Chat"; + +const useStyles = makeStyles(() => ({ + feed: { + width: "100%", + display: "flex", + flexDirection: "column", + alignItems: "center", + }, + root: { + marginTop: "55px", + maxWidth: "800px", + }, + media: { + height: 0, + paddingTop: "56.25%", // 16:9 + }, + comment: { + width: "600px", + height: "75px", + }, + commentItem: { + marginTop: "10px", + }, + commentSend: { + display: "flex", + flexDirection: "row", + }, +})); + +export default function Feed({ comments, setComments }) { + const classes = useStyles(); + const [expanded, setExpanded] = React.useState(false); + const [liked, setLiked] = React.useState(false); + const [inputs, setInputs] = React.useState({ + comment: "", + }); + + const handleExpandClick = () => { + setExpanded(!expanded); + }; + + const handleHeartClick = () => { + setLiked(!liked); + }; + + const handleTextChange = (e) => { + const { name, value } = e.target; + setInputs({ + ...inputs, + [name]: value, + }); + }; + + const handleSendClick = () => { + const comment = { + id: comments.length + 1, + username: "aeuna", + comment: inputs.comment, + }; + setComments([...comments, comment]); + setInputs({ + comment: "", + }); + }; + + return ( +
+ + } + title="aeuna" + subheader="May 14, 2020" + /> + + + + Lorem Ipsum is simply dummy text of the printing and typesetting + industry. Lorem Ipsum has been the industry's standard dummy text + ever since the 1500s.... (데이터 들어오면 몇자 이내로 자를 예정!) + + + 더보기 + + + + + {liked ? : } + + + + + + + + + {comments.map((comment) => ( + + ))} + + + + + +

aeuna

+
+ + + + +
+
+
+
+
+
+
+
+ ); +} diff --git "a/3\354\243\274\354\260\250-NextJS/next-sns/components/Header.js" "b/3\354\243\274\354\260\250-NextJS/next-sns/components/Header.js" new file mode 100644 index 0000000..d6ab96a --- /dev/null +++ "b/3\354\243\274\354\260\250-NextJS/next-sns/components/Header.js" @@ -0,0 +1,109 @@ +import React from "react"; +import Link from "next/link"; +import { + makeStyles, + AppBar, + Toolbar, + IconButton, + Typography, + Badge, + MenuItem, + Menu, +} from "@material-ui/core"; +import AccountCircle from "@material-ui/icons/AccountCircle"; +import NotificationsIcon from "@material-ui/icons/Notifications"; +import AddCircleOutlineIcon from "@material-ui/icons/AddCircleOutline"; + +const useStyles = makeStyles((theme) => ({ + fix: { + position: "fixed", + top: 0, + }, + grow: { + flexGrow: 1, + }, + title: { + display: "none", + [theme.breakpoints.up("sm")]: { + display: "block", + }, + }, + sectionDesktop: { + display: "none", + [theme.breakpoints.up("md")]: { + display: "flex", + }, + }, +})); + +export default function Header() { + const classes = useStyles(); + const [anchorEl, setAnchorEl] = React.useState(null); + + const isMenuOpen = Boolean(anchorEl); + + const handleNotificationMenuOpen = (event) => { + setAnchorEl(event.currentTarget); + }; + + const handleMenuClose = () => { + setAnchorEl(null); + }; + + const menuId = "primary-account-menu"; + const renderMenu = ( + + 알림 1 + 알림 2 + 알림 3 + + ); + return ( +
+ + + + Sullivan-SNS + +
+
+ + + + + + + + + + + + + + + +
+ + + {renderMenu} +
+ ); +} diff --git "a/3\354\243\274\354\260\250-NextJS/next-sns/pages/_app.js" "b/3\354\243\274\354\260\250-NextJS/next-sns/pages/_app.js" index 066a099..eeb1291 100644 --- "a/3\354\243\274\354\260\250-NextJS/next-sns/pages/_app.js" +++ "b/3\354\243\274\354\260\250-NextJS/next-sns/pages/_app.js" @@ -1,23 +1,18 @@ -// function MyApp({ Component, pageProps }) { -// return -// } - -// export default MyApp - -import React from 'react'; -import '../styles/globals.css'; -import PropTypes from 'prop-types'; -import Head from 'next/head'; -import { ThemeProvider } from '@material-ui/core/styles'; -import CssBaseline from '@material-ui/core/CssBaseline'; -import theme from '../src/theme'; +import React from "react"; +import "../styles/globals.css"; +import PropTypes from "prop-types"; +import Head from "next/head"; +import { ThemeProvider } from "@material-ui/core/styles"; +import CssBaseline from "@material-ui/core/CssBaseline"; +import Header from "../components/Header"; +import theme from "../src/theme"; export default function MyApp(props) { const { Component, pageProps } = props; React.useEffect(() => { // Remove the server-side injected CSS. - const jssStyles = document.querySelector('#jss-server-side'); + const jssStyles = document.querySelector("#jss-server-side"); if (jssStyles) { jssStyles.parentElement.removeChild(jssStyles); } @@ -28,14 +23,17 @@ export default function MyApp(props) { My page {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} - +
+
+ +
); diff --git "a/3\354\243\274\354\260\250-NextJS/next-sns/pages/aeuna/index.js" "b/3\354\243\274\354\260\250-NextJS/next-sns/pages/aeuna/index.js" index 2bfa099..a0227fa 100644 --- "a/3\354\243\274\354\260\250-NextJS/next-sns/pages/aeuna/index.js" +++ "b/3\354\243\274\354\260\250-NextJS/next-sns/pages/aeuna/index.js" @@ -1,7 +1,37 @@ -import React from 'react'; +import React from "react"; +import Feed from "../../components/Feed"; const index = () => { - return
sample
; + const [comments, setComments] = React.useState([ + { + id: 1, + username: "aeuna", + comment: "정말 맛있겠다!", + }, + { + id: 2, + username: "kelee98", + comment: "장소가 어디인가용?", + }, + { + id: 3, + username: "xianeml", + comment: "가고 싶어요!", + }, + { + id: 4, + username: "huiji0315", + comment: "나도 가고 싶어요!", + }, + ]); + + return ( + <> + + + + + ); }; export default index; diff --git "a/3\354\243\274\354\260\250-NextJS/next-sns/public/images/test.jpeg" "b/3\354\243\274\354\260\250-NextJS/next-sns/public/images/test.jpeg" new file mode 100644 index 0000000..efccbb4 Binary files /dev/null and "b/3\354\243\274\354\260\250-NextJS/next-sns/public/images/test.jpeg" differ