-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use debounced mutation in create-project and add saving indicator
- Loading branch information
1 parent
701117f
commit 7ee171e
Showing
2 changed files
with
102 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { faSync, faCheck } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
|
||
interface Props { | ||
isSaved: boolean; | ||
lastEdited: Date; | ||
} | ||
|
||
const SavingIndicator: React.FC<Props> = ({ isSaved, lastEdited }) => { | ||
return ( | ||
<div> | ||
<span className="last-edited"> | ||
Last edited:{" "} | ||
{lastEdited.toLocaleString("en-CA", { | ||
timeZone: "America/Vancouver", | ||
dateStyle: "short", | ||
})} | ||
</span> | ||
<span> | ||
<FontAwesomeIcon icon={isSaved ? faCheck : faSync} /> | ||
<span className="is-saved"> | ||
{isSaved ? "Changes saved." : "Saving changes..."} | ||
</span> | ||
</span> | ||
<style jsx> | ||
{` | ||
div { | ||
display: inline-flex; | ||
justify-content: flex-end; | ||
align-items: baseline; | ||
color: #939393; | ||
border: solid 1px #939393; | ||
border-radius: 4px; | ||
padding: 0.5rem; | ||
} | ||
.last-edited { | ||
margin-right: 1rem; | ||
} | ||
.is-saved { | ||
margin-left: 0.5rem; | ||
} | ||
`} | ||
</style> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SavingIndicator; |
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