-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pewpew "latest" version view into scripting. (#205)
* Added eslint key-spacing rule (#204) * Adding toaster, dynamically checking pewpewVersion (#201) * adding files to dynamically show latest pewpew version on Toaster * cleaning up code for lintter to pass * refactoring code to use tags in S3 * removing files from tsconfig * fixing lint rules * fixing spacing as local linter didnt catch those but the build did * missed one space * adding tests, cleaning up files * removing trailing spaces failing on build * adding DS_Store - make specific file to gitignore * updating storybook to show pewpew latest version output --------- Co-authored-by: Bryan <[email protected]>
- Loading branch information
1 parent
f68ad95
commit 77a4464
Showing
18 changed files
with
204 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ testmerge.json | |
.env.development.local* | ||
.env.test.local* | ||
.env.production.local* | ||
|
||
.DS_Store |
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
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
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,49 @@ | ||
import React, { useEffect } from "react"; | ||
import styled, { keyframes } from "styled-components"; | ||
import { Info } from "../Alert"; | ||
|
||
interface ToasterProps { | ||
message: string; // Ensure message prop is of type string | ||
duration?: number; | ||
id: string; // Unique ID for the toaster | ||
} | ||
|
||
// Fade-in animation | ||
const fadeIn = keyframes` | ||
from { opacity: 0; } | ||
to { opacity: 1; } | ||
`; | ||
|
||
// Fade-out animation | ||
const fadeOut = keyframes` | ||
from { opacity: 1; } | ||
to { opacity: 0; } | ||
`; | ||
|
||
const Container = styled(Info)` | ||
position: fixed; | ||
bottom: 20px; | ||
right: 20px; | ||
width: 30%; | ||
font-size: 17px; | ||
animation: ${fadeIn} 0.3s ease-in-out forwards; | ||
&.fade-out { animation: ${fadeOut} 0.3s ease-in-out forwards; } | ||
`; | ||
|
||
const Toaster: React.FC<ToasterProps> = ({ id, message, duration = 7000 }) => { | ||
useEffect(() => { | ||
setTimeout(() => { | ||
const toasterElement = document.getElementById(id); | ||
if (toasterElement) { | ||
toasterElement.classList.add("fade-out"); | ||
setTimeout(() => { | ||
toasterElement.remove(); | ||
}, 300); // Wait for fade-out animation to complete before removing element | ||
} | ||
}, duration); | ||
}, [id, duration]); | ||
return <Container id={id}>{message}</Container>; | ||
}; | ||
|
||
export default Toaster; |
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,16 @@ | ||
import type { Meta, StoryFn } from "@storybook/react"; | ||
import { GlobalStyle } from "../Layout"; | ||
import React from "react"; | ||
import Toaster from "./index"; | ||
|
||
export default { | ||
title: "Toaster", | ||
component: Toaster | ||
} as Meta<typeof Toaster>; | ||
|
||
export const Default: StoryFn = () => ( | ||
<React.Fragment> | ||
<GlobalStyle /> | ||
<Toaster id="toaster" message={"Type your message here: "}/> | ||
</React.Fragment> | ||
); |
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
Oops, something went wrong.