Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
refactor: reduce wallet card count on dashboard (#2958)
Browse files Browse the repository at this point in the history
  • Loading branch information
dated authored Oct 9, 2020
1 parent 4f3f177 commit 4d197c5
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 668 deletions.
2 changes: 1 addition & 1 deletion src/app/components/Slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type SliderProps = {

const defaultOptions = {
// Custom component options
slideHeight: 184, // default slideheight (used for wallet cards),
slideHeight: 185, // default slideheight (used for wallet cards),
// Swiper options
slidesPerView: 1,
slidesPerColumn: 1,
Expand Down
32 changes: 16 additions & 16 deletions src/app/components/Slider/__snapshots__/Slider.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ exports[`Slider should render 1`] = `
>
<div
class="swiper-container swiper-container-initialized swiper-container-horizontal"
style="height: 184px;"
style="height: 185px;"
>
<div
class="h-full swiper-wrapper "
style="transition: 0ms; transform: translate3d(NaNpx, 0px, 0px);"
>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div>
Slider item
Expand All @@ -34,15 +34,15 @@ exports[`Slider should render empty rows if template not provided 1`] = `
>
<div
class="swiper-container swiper-container-initialized swiper-container-horizontal"
style="height: 184px;"
style="height: 185px;"
>
<div
class="h-full swiper-wrapper "
style="transition: 0ms; transform: translate3d(NaNpx, 0px, 0px);"
>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
Expand All @@ -59,75 +59,75 @@ exports[`Slider should render pagination 1`] = `
>
<div
class="swiper-container swiper-container-initialized swiper-container-horizontal"
style="height: 248px;"
style="height: 249px;"
>
<div
class="h-full swiper-wrapper "
style="transition: 0ms; transform: translate3d(NaNpx, 0px, 0px);"
>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
<div
class="swiper-slide"
style="height: 184px;"
style="height: 185px;"
>
<div />
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/domains/dashboard/components/Wallets/Wallets.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("Wallets", () => {
expect(asFragment()).toMatchSnapshot();
});

it("should render one grid row when less than four wallets", () => {
it("should render one grid row when less than three wallets", () => {
const { asFragment, getAllByTestId } = renderWithRouter(
<Route path="/profiles/:profileId/dashboard">
<Wallets wallets={new Array(1).fill(wallets[0])} filterProperties={filterProperties} />
Expand All @@ -70,11 +70,11 @@ describe("Wallets", () => {
},
);

expect(getAllByTestId("WalletCard__blank")).toHaveLength(3);
expect(getAllByTestId("WalletCard__blank")).toHaveLength(2);
expect(asFragment()).toMatchSnapshot();
});

it("should render two grid rows when more than four wallets", () => {
it("should render two grid rows when more than three wallets", () => {
const { asFragment, getAllByTestId } = renderWithRouter(
<Route path="/profiles/:profileId/dashboard">
<Wallets wallets={new Array(5).fill(wallets[0])} filterProperties={filterProperties} />
Expand All @@ -85,7 +85,7 @@ describe("Wallets", () => {
},
);

expect(getAllByTestId("WalletCard__blank")).toHaveLength(3);
expect(getAllByTestId("WalletCard__blank")).toHaveLength(1);
expect(asFragment()).toMatchSnapshot();
});

Expand Down
4 changes: 2 additions & 2 deletions src/domains/dashboard/components/Wallets/Wallets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export const Wallets = ({

const walletSliderOptions = {
slideHeight: 185,
slidesPerView: 4,
slidesPerView: 3,
slidesPerColumn: 2,
slidesPerGroup: 4,
slidesPerGroup: 3,
spaceBetween: 20,
};

Expand Down
Loading

0 comments on commit 4d197c5

Please sign in to comment.