Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Gatsby Theme Onegeo
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OneGeo Suite
Libs
Gatsby Theme Onegeo
Commits
63bf5b01
Commit
63bf5b01
authored
2 years ago
by
tovo
Browse files
Options
Downloads
Patches
Plain Diff
format code
parent
19019f6f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/core/CardList.tsx
+43
-63
43 additions, 63 deletions
src/components/core/CardList.tsx
with
43 additions
and
63 deletions
src/components/core/CardList.tsx
+
43
−
63
View file @
63bf5b01
...
...
@@ -3,80 +3,60 @@ import { IGatsbyImageData } from "gatsby-plugin-image";
import
Card
from
"
./Card
"
;
interface
CardProps
{
title
?:
string
;
content
?:
string
;
image
?:
string
|
IGatsbyImageData
;
to
?:
string
;
anime
?:
boolean
;
layout
?:
"
top
"
|
"
left
"
;
className
?:
string
;
title
?:
string
;
content
?:
string
;
image
?:
string
|
IGatsbyImageData
;
to
?:
string
;
anime
?:
boolean
;
layout
?:
"
top
"
|
"
left
"
;
className
?:
string
;
}
interface
Props
{
cards
?:
CardProps
[];
layout
?:
'
row
'
|
'
col
'
|
'
grid
'
;
className
?:
string
;
anime
?:
boolean
;
cards
?:
CardProps
[];
layout
?:
"
row
"
|
"
col
"
|
"
grid
"
;
className
?:
string
;
anime
?:
boolean
;
}
const
oCardProps
=
{
'
row
'
:
{
layout
:
'
left
'
,
className
:
''
},
'
col
'
:
{
layout
:
'
top
'
,
className
:
''
},
'
grid
'
:
{
layout
:
'
top
'
,
className
:
'
max-w-full
'
}
}
row
:
{
layout
:
"
left
"
,
className
:
""
,
},
col
:
{
layout
:
"
top
"
,
className
:
""
,
},
grid
:
{
layout
:
"
top
"
,
className
:
"
max-w-full
"
,
},
};
const
CardList
=
(
props
:
Props
)
=>
{
const
{
cards
=
[],
layout
=
'
row
'
,
className
=
''
,
anime
=
true
}
=
props
;
const
oListClassName
=
{
'
row
'
:
`space-y-10 w-full
${
className
}
`
,
'
col
'
:
`flex space-x-12 flex-nowrap justify-center
${
className
}
`
,
'
grid
'
:
`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-12
${
className
}
`
}
const
tmpProps
=
oCardProps
[
layout
];
const
listCards
=
cards
.
map
((
card
,
index
)
=>
{
let
cardProps
=
{
...
card
,
...
tmpProps
,
anime
};
const
{
cards
=
[],
layout
=
"
row
"
,
className
=
""
,
anime
=
true
}
=
props
;
return
(
<
Card
key
=
{
index
}
{
...(
cardProps
as
CardProps
)
}
/>
)
})
const
oListClassName
=
{
row
:
`space-y-10 w-full
${
className
}
`
,
col
:
`flex space-x-12 flex-nowrap justify-center
${
className
}
`
,
grid
:
`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-12
${
className
}
`
,
};
return
(
<
div
className
=
{
oListClassName
[
layout
]
}
>
{
listC
ard
s
}
</
div
>
)
};
const
tmpProps
=
oCardProps
[
layout
];
const
listCards
=
cards
.
map
((
card
,
index
)
=>
{
let
cardProps
=
{
...
c
ard
,
...
tmpProps
,
anime
,
};
return
<
Card
key
=
{
index
}
{
...(
cardProps
as
CardProps
)
}
/>;
});
return
<
div
className
=
{
oListClassName
[
layout
]
}
>
{
listCards
}
</
div
>;
};
export
default
CardList
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment