-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1446 from getAlby/task-success-screen
feat: success screen component (LNURLPay)
- Loading branch information
Showing
9 changed files
with
152 additions
and
53 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,39 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import { MemoryRouter } from "react-router-dom"; | ||
|
||
import type { Props } from "./index"; | ||
import ResultCard from "./index"; | ||
|
||
const successProps: Props = { | ||
isSuccess: true, | ||
message: "Test Successful!", | ||
}; | ||
|
||
const failureProps: Props = { | ||
isSuccess: false, | ||
message: "Test Successful!", | ||
}; | ||
|
||
describe("ResultCard", () => { | ||
test("success render", async () => { | ||
render( | ||
<MemoryRouter> | ||
<ResultCard {...successProps} /> | ||
</MemoryRouter> | ||
); | ||
|
||
expect(screen.getByText("Test Successful!")).toBeInTheDocument(); | ||
expect(screen.getByAltText("success")).toBeInTheDocument(); | ||
}); | ||
|
||
test("failure render", async () => { | ||
render( | ||
<MemoryRouter> | ||
<ResultCard {...failureProps} /> | ||
</MemoryRouter> | ||
); | ||
|
||
expect(screen.getByText("Test Successful!")).toBeInTheDocument(); | ||
expect(screen.getByAltText("failure")).toBeInTheDocument(); | ||
}); | ||
}); |
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,17 @@ | ||
export type Props = { | ||
isSuccess: boolean; | ||
message: string; | ||
}; | ||
|
||
export default function ResultCard({ message, isSuccess }: Props) { | ||
return ( | ||
<div className="p-12 font-medium drop-shadow rounded-lg mt-4 flex flex-col items-center bg-white dark:bg-surface-02dp"> | ||
<img | ||
src={isSuccess ? "assets/icons/tick.svg" : "assets/icons/cross.svg"} | ||
alt={isSuccess ? "success" : "failure"} | ||
className="mb-8" | ||
/> | ||
<p className="text-center">{message}</p> | ||
</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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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