Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
WordPress UI Components
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
wpdesk
WordPress UI Components
Merge requests
!1
Main
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Closed
Main
main
into
just_for_review
Overview
18
Commits
14
Pipelines
10
Changes
1
All threads resolved!
Hide all comments
Closed
Eryk Mika
requested to merge
main
into
just_for_review
4 months ago
Overview
18
Commits
14
Pipelines
10
Changes
1
All threads resolved!
Hide all comments
0
0
Merge request reports
Viewing commit
77f49f8c
Prev
Next
Show latest version
1 file
+
6
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
77f49f8c
fix: NumberWithUnit error handling
· 77f49f8c
Eryk Mika
authored
4 months ago
src/NumberWithUnit/NumberWithUnit.jsx
+
6
−
0
View file @ 77f49f8c
Edit in single-file editor
Open in Web IDE
Show full file
@@ -4,7 +4,13 @@ import {useState} from "react";
@@ -4,7 +4,13 @@ import {useState} from "react";
export
default
function
NumberWithUnit
({
label
,
onChange
,
value
,
className
})
{
export
default
function
NumberWithUnit
({
label
,
onChange
,
value
,
className
})
{
const
splitValues
=
function
(
fontSize
)
{
const
splitValues
=
function
(
fontSize
)
{
if
(
!
fontSize
)
{
return
{
size
:
"
0
"
,
unit
:
"
px
"
};
}
const
match
=
fontSize
.
match
(
/^
(\d
+
)([
a-z%
]
+
)
$/i
);
const
match
=
fontSize
.
match
(
/^
(\d
+
)([
a-z%
]
+
)
$/i
);
if
(
!
match
)
{
if
(
!
match
)
{
return
{
size
:
"
16
"
,
unit
:
"
px
"
};
return
{
size
:
"
16
"
,
unit
:
"
px
"
};
}
}
Loading