Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: HS-12345: Refactor Payment Element shimmer, Modal setState #147

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Components/Modal.res
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let make = (
}

React.useEffect1(() => {
loader ? setOpenModal(_ => false) : setOpenModal(_ => true)
setOpenModal(_ => !loader)
None
}, [loader])

Expand Down
48 changes: 18 additions & 30 deletions src/Components/PaymentElementShimmer.res
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,30 @@ module Shimmer = {
}
}

@react.component
let make = () => {
<div className="flex flex-col gap-4">
<Shimmer>
<div className="animate-pulse w-full h-12 rounded bg-slate-200 ">
<div className="flex flex-row my-auto">
<div className=" w-10 h-5 rounded-full m-3 bg-white bg-opacity-70 " />
<div className=" my-auto w-24 h-2 rounded m-3 bg-white bg-opacity-70 " />
</div>
</div>
</Shimmer>
<Shimmer>
<div className="animate-pulse w-full h-12 rounded bg-slate-200 ">
<div className="flex flex-row my-auto">
<div className=" w-10 h-5 rounded-full m-3 bg-white bg-opacity-70 " />
<div className=" my-auto w-24 h-2 rounded m-3 bg-white bg-opacity-70 " />
</div>
</div>
</Shimmer>
<div className="flex flex-row gap-4 w-full">
<Shimmer>
<div className="animate-pulse w-auto h-12 rounded bg-slate-200">
<div className="flex flex-row my-auto">
<div className=" w-10 h-5 rounded-full m-3 bg-white bg-opacity-70 " />
<div className=" my-auto w-24 h-2 rounded m-3 bg-white bg-opacity-70 " />
</div>
</div>
</Shimmer>
<Shimmer>
<div className="animate-pulse w-auto h-12 rounded bg-slate-200">
module ElementShimmer = {
@react.component
let make = (~n=1) => {
Belt.Array.range(0, n - 1)
->Js.Array2.map(index => {
<Shimmer key={index->Belt.Int.toString}>
<div className="animate-pulse w-full h-12 rounded bg-slate-200 ">
prafulkoppalkar marked this conversation as resolved.
Show resolved Hide resolved
<div className="flex flex-row my-auto">
prafulkoppalkar marked this conversation as resolved.
Show resolved Hide resolved
<div className=" w-10 h-5 rounded-full m-3 bg-white bg-opacity-70 " />
prafulkoppalkar marked this conversation as resolved.
Show resolved Hide resolved
<div className=" my-auto w-24 h-2 rounded m-3 bg-white bg-opacity-70 " />
prafulkoppalkar marked this conversation as resolved.
Show resolved Hide resolved
</div>
</div>
</Shimmer>
})
->React.array
}
}

@react.component
let make = () => {
<div className="flex flex-col gap-4">
<ElementShimmer n=2 />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if n is always going to be 2, it might as well not exist as a prop

<div className="flex flex-row gap-4 w-full">
<ElementShimmer n=2 />
</div>
</div>
}
Loading