Skip to content

Commit

Permalink
added save icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Patricio Vargas committed Aug 12, 2021
1 parent 6eae538 commit afcdd7d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
border-radius: 24px;
width: 150px;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
}

.App-logo {
Expand Down
9 changes: 9 additions & 0 deletions src/components/SVGs/save.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';

const Save = () =>(
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#FFFFFF">
<path d="M0 0h24v24H0V0z" fill="none"/><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm2 16H5V5h11.17L19 7.83V19zm-7-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3zM6 6h9v4H6z"/>
</svg>
);

export default Save;
10 changes: 7 additions & 3 deletions src/components/Writer/Writer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import './Writer.css';
import Save from '../SVGs/save';

const Writer = ({writeFn}) => {
const [message, setMessage] = React.useState('');
Expand All @@ -9,13 +10,16 @@ const Writer = ({writeFn}) => {
writeFn(message);
setMessage('');
};

return (
<>
<form onSubmit={onSave}>
<div className="writer-container">
<input type="text" placeholder="Enter Message..." value={message} onChange={(e)=>setMessage(e.target.value )}></input>
<button className="btn" type="submit">Save</button>
<input type="text" placeholder="Enter Message..." value={message} onChange={(e)=>setMessage(e.target.value)}></input>
<button className="btn" type="submit">
<Save/>
Save
</button>
</div>
</form>
</>
Expand Down
3 changes: 1 addition & 2 deletions src/containers/Write.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import Writer from '../components/Writer/Writer';

const Write = () => {
const onWrite = async(message) => {
console.log('write', message);
try {
const ndef = new window.NDEFReader();
await ndef.write({records: [{ recordType: "text", data: "Hello World!" }]});
alert(`Value Saved!`);
console.log(`Value Saved!`);
} catch (error) {
console.log(error);
}
Expand Down
1 change: 1 addition & 0 deletions src/save.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit afcdd7d

Please sign in to comment.