Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bkunyun
Commits
c7f631b9
Commit
c7f631b9
authored
Aug 31, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: tab切换按钮样式修改
parent
de0ea244
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
12 deletions
+43
-12
index.module.css
...CommonComponents/RadioGroupOfButtonStyle/index.module.css
+8
-0
index.tsx
...onents/CommonComponents/RadioGroupOfButtonStyle/index.tsx
+35
-12
No files found.
src/components/CommonComponents/RadioGroupOfButtonStyle/index.module.css
View file @
c7f631b9
...
...
@@ -33,3 +33,11 @@
background-color
:
#fff
;
box-shadow
:
2px
4px
12px
0px
rgba
(
0
,
27
,
63
,
0.06
);
}
.border
{
width
:
1px
;
height
:
16px
;
background-color
:
rgba
(
209
,
214
,
222
,
1
);
}
.borderHidden
{
visibility
:
hidden
;
}
src/components/CommonComponents/RadioGroupOfButtonStyle/index.tsx
View file @
c7f631b9
...
...
@@ -8,6 +8,7 @@
*/
// 按钮样式的单选组
import
classnames
from
"classnames"
;
import
{
useMemo
}
from
"react"
;
import
style
from
"./index.module.css"
;
type
radioOption
=
{
...
...
@@ -27,21 +28,43 @@ const RadioGroupOfButtonStyle = (props: IRadioGroupOfButtonStyleProps) => {
const
{
radioOptions
,
value
,
handleRadio
,
RadiosBoxStyle
,
radioStyle
}
=
props
;
const
activeIndex
:
any
=
useMemo
(()
=>
{
let
res
=
0
;
radioOptions
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
value
===
value
)
{
res
=
index
;
}
});
return
res
;
},
[
value
,
radioOptions
]);
return
(
<
div
className=
{
style
.
RadiosBox
}
style=
{
RadiosBoxStyle
}
>
{
radioOptions
.
map
((
options
)
=>
{
{
radioOptions
.
map
((
options
,
index
)
=>
{
return
(
<
div
key=
{
options
.
value
}
className=
{
classnames
({
[
style
.
radio
]:
true
,
[
style
.
radioActive
]:
value
===
options
.
value
,
})
}
onClick=
{
()
=>
handleRadio
(
options
.
value
)
}
style=
{
radioStyle
}
>
{
options
.
label
}
</
div
>
<>
<
div
key=
{
options
.
value
}
className=
{
classnames
({
[
style
.
radio
]:
true
,
[
style
.
radioActive
]:
value
===
options
.
value
,
})
}
onClick=
{
()
=>
handleRadio
(
options
.
value
)
}
style=
{
radioStyle
}
>
{
options
.
label
}
</
div
>
<
div
className=
{
classnames
({
[
style
.
border
]:
true
,
[
style
.
borderHidden
]:
!
(
index
!==
radioOptions
.
length
-
1
&&
index
!==
activeIndex
&&
index
!==
activeIndex
-
1
),
})
}
></
div
>
</>
);
})
}
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment