-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31b3400
commit a182f6c
Showing
8 changed files
with
73 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import { forwardRef } from "react"; | ||
import styles from "./Button.module.css"; | ||
|
||
export default function Button(props) { | ||
const Button = forwardRef((props, ref) => { | ||
return ( | ||
<button className={styles.btn} {...props}> | ||
<button className={styles.btn} ref={ref} {...props}> | ||
{props.children} | ||
</button> | ||
); | ||
} | ||
}); | ||
|
||
export default Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useState } from "react"; | ||
import Button from "./Button"; | ||
|
||
export default function Header(props) { | ||
const [isEditMode, setIsEditMode] = useState(false); | ||
|
||
return ( | ||
<div> | ||
{isEditMode ? ( | ||
<> | ||
<input | ||
style={{ height: 70, fontSize: 28, marginRight: 5 }} | ||
value={props.value} | ||
onChange={(e) => props.setValue(e.target.value)} | ||
/> | ||
<Button onClick={() => setIsEditMode(false)}>✔️</Button> | ||
</> | ||
) : ( | ||
<h1 onClick={() => setIsEditMode(true)} align="center"> | ||
{props.value} | ||
</h1> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
- [JavaScript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) | ||
|
||
- [Controlled vs Uncontrolled Forms](https://reactjs.org/docs/uncontrolled-components.html#:~:text=In%20a%20controlled%20component%2C%20form,form%20values%20from%20the%20DOM.) | ||
|
||
- [vite](https://vitejs.dev/) | ||
|
||
- [React](https://beta.reactjs.org/learn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a182f6c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nit-news – ./
nit-news-always-maap.vercel.app
nit-news-git-master-always-maap.vercel.app
nit-news.vercel.app