From 7749c004b3e482d6c61468c447a94897e014fc6e Mon Sep 17 00:00:00 2001 From: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Wed, 4 Sep 2024 22:06:43 -0400 Subject: [PATCH] feat: new code for inputs --- changelog-app-ui/src/App.jsx | 13 ++++-- .../src/components/changeLogInput.jsx | 39 ++++++++++++++++ .../src/components/changeLogInput.module.css | 45 +++++++++++++++++++ .../src/components/feed.module.css | 1 + changelog-app-ui/src/index.css | 27 ++--------- 5 files changed, 98 insertions(+), 27 deletions(-) create mode 100644 changelog-app-ui/src/components/changeLogInput.jsx create mode 100644 changelog-app-ui/src/components/changeLogInput.module.css diff --git a/changelog-app-ui/src/App.jsx b/changelog-app-ui/src/App.jsx index 7862980..8a0ec1f 100644 --- a/changelog-app-ui/src/App.jsx +++ b/changelog-app-ui/src/App.jsx @@ -1,20 +1,25 @@ //import "./App.css"; import { useState } from "react"; import Feed from "./components/feed"; +import ChangeLogInput from "./components/changeLogInput"; function App() { const [feed, setFeed] = useState(tempData); + const [logInput, setLogInput] = useState(""); + return ( <> + ); } -//body={item.body} -//topics={item.topics} -//date={item.date} - const tempData = [ { body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vitae nibh velit. Vivamus maximus elit et eleifend hendrerit. Praesent ac metus eget risus accumsan finibus. Cras tempor dignissim dolor, ut tempus tortor interdum non. Sed sit amet fringilla turpis. Sed congue feugiat orci, vel iaculis libero venenatis eu.", diff --git a/changelog-app-ui/src/components/changeLogInput.jsx b/changelog-app-ui/src/components/changeLogInput.jsx new file mode 100644 index 0000000..bb05f2d --- /dev/null +++ b/changelog-app-ui/src/components/changeLogInput.jsx @@ -0,0 +1,39 @@ +import PropTypes from "prop-types"; +import styles from "./changeLogInput.module.css"; + +const ChangeLogInput = (props) => { + const handleClick = (e) => { + const newEntry = { + body: props.logInput, + topics: ["test"], + date: new Date().toLocaleDateString(), + id: crypto.randomUUID(), + }; + + props.setFeed([newEntry, ...props.feed]); + props.setLogInput(""); + }; + return ( +
+