Skip to content

Commit

Permalink
Add story-book skeleton for materialgrid & use CLSX in recommended-ma…
Browse files Browse the repository at this point in the history
…terial.

Recommended-material was rendering "False" for the partOfGrid prop because it was not using clsx.

DDFFORM-490
  • Loading branch information
LasseStaus committed Apr 22, 2024
1 parent bf81918 commit 70018d3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import serviceUrlArgs from "../../../core/storybook/serviceUrlArgs";
import MaterialGridAutomatic, {
MaterialGridAutomaticEntryProps
} from "./MaterialGridAutomatic.entry";
import MaterialGridSkeleton from "../MaterialGridSkeleton";

export default {
title: "Apps / Material Grid / Automatic",
Expand Down Expand Up @@ -79,3 +80,10 @@ export default {
export const App: ComponentStory<typeof MaterialGridAutomatic> = (
args: MaterialGridAutomaticEntryProps & GlobalEntryTextProps
) => <MaterialGridAutomatic {...args} />;

const SkeletonTemplate: ComponentStory<typeof MaterialGridAutomatic> = (
args
) => {
return <MaterialGridSkeleton />;
};
export const Skeleton = SkeletonTemplate.bind({});
6 changes: 6 additions & 0 deletions src/apps/material-grid/manual/MaterialGridManual.dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import serviceUrlArgs from "../../../core/storybook/serviceUrlArgs";
import MaterialGridManual, {
MaterialGridManualEntryProps
} from "./MaterialGridManual.entry";
import MaterialGridSkeleton from "../MaterialGridSkeleton";

// 31 materials. Intentionally not using 32 in order to demonstrate the
// logic for only displaying intervals of 4 materials.
Expand Down Expand Up @@ -103,3 +104,8 @@ export default {
export const App: ComponentStory<typeof MaterialGridManual> = (
args: MaterialGridManualEntryProps & GlobalEntryTextProps
) => <MaterialGridManual {...args} />;

const SkeletonTemplate: ComponentStory<typeof MaterialGridManual> = (args) => {
return <MaterialGridSkeleton />;
};
export const Skeleton = SkeletonTemplate.bind({});
8 changes: 5 additions & 3 deletions src/apps/recommended-material/RecommendedMaterial.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from "react";
import clsx from "clsx";
import { useDispatch } from "react-redux";
import { useQueryClient } from "react-query";
import ButtonFavourite, {
Expand Down Expand Up @@ -79,9 +80,10 @@ const RecommendedMaterial: React.FC<RecommendedMaterialProps> = ({

return (
<div
className={`recommended-material ${
partOfGrid && "recommended-material--in-grid "
}`}
className={clsx(
"recommended-material",
partOfGrid && "recommended-material--in-grid"
)}
>
<div className="recommended-material__icon">
<ButtonFavourite
Expand Down

0 comments on commit 70018d3

Please sign in to comment.