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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OneGeo Suite
Libs
Gatsby Theme Onegeo
Commits
1e1f590a
Commit
1e1f590a
authored
Oct 28, 2022
by
Tojo
Browse files
Options
Downloads
Patches
Plain Diff
carousel
parent
98b8f124
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/core/Carousel.tsx
+60
-0
60 additions, 0 deletions
src/components/core/Carousel.tsx
with
60 additions
and
0 deletions
src/components/core/Carousel.tsx
0 → 100644
+
60
−
0
View file @
1e1f590a
import
React
from
"
react
"
;
interface
DataImage
{
id
:
number
src
:
string
}
interface
Props
{
images
:
Array
<
DataImage
>
}
// const Carousel:React.FC<Props> = ({images}) => {
const
Carousel
=
()
=>
{
const
dataImage
=
[
{
id
:
1
,
src
:
"
https://placeimg.com/800/200/arch
"
,
},
{
id
:
2
,
src
:
"
https://placeimg.com/800/200/arch
"
,
},
{
id
:
3
,
src
:
"
https://placeimg.com/800/200/arch
"
,
},
{
id
:
4
,
src
:
"
https://placeimg.com/800/200/arch
"
,
},
];
const
nbr_image
:
number
=
dataImage
.
length
;
return
(
<
div
className
=
"carousel w-full"
>
{
dataImage
.
map
((
item
:
any
,
key
:
any
)
=>
{
return
(
<
div
id
=
{
item
.
id
}
className
=
"carousel-item relative w-full"
key
=
{
key
}
>
<
img
src
=
{
item
.
src
}
className
=
"w-full"
/>
<
div
className
=
"absolute flex justify-between transform -translate-y-1/2 left-5 right-5 top-1/2"
>
<
a
href
=
{
(
item
.
id
==
1
)
?
`#
${
nbr_image
}
`
:
`#
${
item
.
id
-
1
}
`
}
className
=
"btn btn-circle"
>
❮
</
a
>
<
a
href
=
{
(
item
.
id
==
nbr_image
)
?
`#1`
:
`#
${
item
.
id
+
1
}
`
}
className
=
"btn btn-circle"
>
❯
</
a
>
</
div
>
</
div
>
)
})
}
</
div
>
);
};
export
default
Carousel
;
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