Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
holi-frontends
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
app
holi-frontends
Commits
d62269cb
Commit
d62269cb
authored
2 months ago
by
Joao Ramia
Browse files
Options
Downloads
Patches
Plain Diff
feat(HoliBricks): introduce iconBefore and scaleIcon props for Button
parent
57374dc5
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
holi-bricks/components/button/Button.tsx
+10
-2
10 additions, 2 deletions
holi-bricks/components/button/Button.tsx
with
10 additions
and
2 deletions
holi-bricks/components/button/Button.tsx
+
10
−
2
View file @
d62269cb
...
@@ -37,6 +37,8 @@ export type ButtonProps = AccessibilityProps & {
...
@@ -37,6 +37,8 @@ export type ButtonProps = AccessibilityProps & {
transparent
?:
boolean
transparent
?:
boolean
selected
?:
boolean
selected
?:
boolean
icon
?:
HoliIconType
icon
?:
HoliIconType
iconBefore
?:
HoliIconType
scaleIcon
?:
number
inline
?:
boolean
inline
?:
boolean
testID
?:
string
testID
?:
string
}
}
...
@@ -52,6 +54,8 @@ export const Button = ({
...
@@ -52,6 +54,8 @@ export const Button = ({
transparent
=
false
,
transparent
=
false
,
selected
=
false
,
selected
=
false
,
icon
,
icon
,
iconBefore
,
scaleIcon
=
1
,
inline
=
false
,
inline
=
false
,
testID
,
testID
,
...
rest
...
rest
...
@@ -67,6 +71,7 @@ export const Button = ({
...
@@ -67,6 +71,7 @@ export const Button = ({
const
isSpinning
=
loading
||
isProcessing
const
isSpinning
=
loading
||
isProcessing
const
labelToShow
=
isSpinning
&&
loadingLabel
?
loadingLabel
:
label
const
labelToShow
=
isSpinning
&&
loadingLabel
?
loadingLabel
:
label
const
iconSize
=
16
*
scaleIcon
const
handlePress
=
useCallback
(
const
handlePress
=
useCallback
(
async
(
event
:
GestureResponderEvent
)
=>
{
async
(
event
:
GestureResponderEvent
)
=>
{
...
@@ -103,6 +108,9 @@ export const Button = ({
...
@@ -103,6 +108,9 @@ export const Button = ({
{
...
accessibilityProps
(
rest
)
}
{
...
accessibilityProps
(
rest
)
}
>
>
<
View
style
=
{
styles
.
content
}
>
<
View
style
=
{
styles
.
content
}
>
{
iconBefore
&&
!
isSpinning
&&
(
<
HoliIcon
icon
=
{
iconBefore
}
size
=
{
iconSize
}
color
=
{
styles
.
text
(
disabled
,
selected
,
variant
).
color
}
/>
)
}
<
View
style
=
{
styles
.
textContainer
(
size
)
}
>
<
View
style
=
{
styles
.
textContainer
(
size
)
}
>
<
Text
size
=
{
size
===
'
lg
'
?
'
md
'
:
'
sm
'
}
colorOveride
=
{
styles
.
text
(
disabled
,
selected
,
variant
).
color
}
>
<
Text
size
=
{
size
===
'
lg
'
?
'
md
'
:
'
sm
'
}
colorOveride
=
{
styles
.
text
(
disabled
,
selected
,
variant
).
color
}
>
{
labelToShow
}
{
labelToShow
}
...
@@ -111,12 +119,12 @@ export const Button = ({
...
@@ -111,12 +119,12 @@ export const Button = ({
{
isSpinning
&&
(
{
isSpinning
&&
(
<
View
testID
=
"spinner"
>
<
View
testID
=
"spinner"
>
<
SpinningIconContainer
spinning
=
{
isSpinning
}
>
<
SpinningIconContainer
spinning
=
{
isSpinning
}
>
<
HoliIcon
icon
=
{
Loader
}
size
=
{
16
}
color
=
{
styles
.
text
(
disabled
,
selected
,
variant
).
color
}
/>
<
HoliIcon
icon
=
{
Loader
}
size
=
{
iconSize
}
color
=
{
styles
.
text
(
disabled
,
selected
,
variant
).
color
}
/>
</
SpinningIconContainer
>
</
SpinningIconContainer
>
</
View
>
</
View
>
)
}
)
}
{
!
isSpinning
&&
icon
&&
(
{
!
isSpinning
&&
icon
&&
(
<
HoliIcon
icon
=
{
icon
}
size
=
{
16
}
color
=
{
styles
.
text
(
disabled
,
selected
,
variant
).
color
}
/>
<
HoliIcon
icon
=
{
icon
}
size
=
{
iconSize
}
color
=
{
styles
.
text
(
disabled
,
selected
,
variant
).
color
}
/>
)
}
)
}
</
View
>
</
View
>
</
Pressable
>
</
Pressable
>
...
...
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