refactor(stackedComponents): update ElementStack component to use CSS grid for layout instead of flexbox

fix(market-card.tsx): fix variable name in MarketCardComponent to correctly display tags in ElementStack component
This commit is contained in:
anovazzi1 2023-10-27 17:56:23 -03:00
commit 2911f8751a
2 changed files with 18 additions and 8 deletions

View file

@ -6,14 +6,19 @@ interface ElementStackProps {
const ElementStack: React.FC<ElementStackProps> = ({ children }) => {
return (
<div className="relative flex">
<div
className={`grid grid-cols-3`}
style={{ display: "grid", gridAutoFlow: "row" }}
>
{children.map((child, index) => (
<div
key={index}
className={` transform translate-x-${index * 4} -translate-y-${
index * 2
} scale-${100 - index * 3}`}
style={{ zIndex: children.length - index }}
style={{
gridColumn: 1,
gridRow: 1,
transform: `translateX(${index * 0.3}rem)`,
zIndex: children.length - index,
}}
>
{child}
</div>

View file

@ -167,10 +167,15 @@ export const MarketCardComponent = ({ data }: { data: storeComponent }) => {
}
>
<div>
{data.tags.length > 0 ? (
{testTags.length > 0 ? (
<ElementStack>
{data.tags.map((tag, index) => (
<Badge key={index} size="md" variant="outline">
{testTags.map((tag, index) => (
<Badge
key={index}
size="md"
className="bg-card"
variant="outline"
>
{"tag"}
</Badge>
))}