Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
LuckySwap
interface
Commits
a4fbfae4
Unverified
Commit
a4fbfae4
authored
Mar 03, 2022
by
Zach Pomerantz
Committed by
GitHub
Mar 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: set appropriate types to nowrap (#3392)
parent
b2288258
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
10 deletions
+28
-10
type.tsx
src/lib/theme/type.tsx
+28
-10
No files found.
src/lib/theme/type.tsx
View file @
a4fbfae4
...
@@ -5,10 +5,11 @@ import { Color } from './theme'
...
@@ -5,10 +5,11 @@ import { Color } from './theme'
type
TextProps
=
Omit
<
TextPropsWithCss
,
'
css
'
|
'
color
'
>
&
{
color
?:
Color
}
type
TextProps
=
Omit
<
TextPropsWithCss
,
'
css
'
|
'
color
'
>
&
{
color
?:
Color
}
const
TextWrapper
=
styled
(
Text
)
<
{
color
?:
Color
;
lineHeight
:
string
}
>
`
const
TextWrapper
=
styled
(
Text
)
<
{
color
?:
Color
;
lineHeight
:
string
;
noWrap
?:
true
}
>
`
color:
${({
color
=
'
currentColor
'
,
theme
})
=>
theme
[
color
as
Color
]}
;
color:
${({
color
=
'
currentColor
'
,
theme
})
=>
theme
[
color
as
Color
]}
;
// Avoid the need for placeholders by setting min-height to line-height.
// Avoid the need for placeholders by setting min-height to line-height.
min-height:
${({
lineHeight
})
=>
lineHeight
}
;
min-height:
${({
lineHeight
})
=>
lineHeight
}
;
white-space:
${({
noWrap
})
=>
noWrap
&&
'
nowrap
'
}
;
`
`
const
TransitionTextWrapper
=
styled
(
TextWrapper
)
`
const
TransitionTextWrapper
=
styled
(
TextWrapper
)
`
...
@@ -16,23 +17,33 @@ const TransitionTextWrapper = styled(TextWrapper)`
...
@@ -16,23 +17,33 @@ const TransitionTextWrapper = styled(TextWrapper)`
`
`
export
function
H1
(
props
:
TextProps
)
{
export
function
H1
(
props
:
TextProps
)
{
return
<
TextWrapper
className=
"headline headline-1"
fontSize=
{
36
}
fontWeight=
{
400
}
lineHeight=
"36px"
{
...
props
}
/>
return
(
<
TextWrapper
className=
"headline headline-1"
fontSize=
{
36
}
fontWeight=
{
400
}
lineHeight=
"36px"
noWrap
{
...
props
}
/>
)
}
}
export
function
H2
(
props
:
TextProps
)
{
export
function
H2
(
props
:
TextProps
)
{
return
<
TextWrapper
className=
"headline headline-2"
fontSize=
{
32
}
fontWeight=
{
400
}
lineHeight=
"32px"
{
...
props
}
/>
return
(
<
TextWrapper
className=
"headline headline-2"
fontSize=
{
32
}
fontWeight=
{
400
}
lineHeight=
"32px"
noWrap
{
...
props
}
/>
)
}
}
export
function
H3
(
props
:
TextProps
)
{
export
function
H3
(
props
:
TextProps
)
{
return
<
TextWrapper
className=
"headline headline-3"
fontSize=
{
20
}
fontWeight=
{
400
}
lineHeight=
"20px"
{
...
props
}
/>
return
(
<
TextWrapper
className=
"headline headline-3"
fontSize=
{
20
}
fontWeight=
{
400
}
lineHeight=
"20px"
noWrap
{
...
props
}
/>
)
}
}
export
function
Subhead1
(
props
:
TextProps
)
{
export
function
Subhead1
(
props
:
TextProps
)
{
return
<
TextWrapper
className=
"subhead subhead-1"
fontSize=
{
16
}
fontWeight=
{
500
}
lineHeight=
"16px"
{
...
props
}
/>
return
(
<
TextWrapper
className=
"subhead subhead-1"
fontSize=
{
16
}
fontWeight=
{
500
}
lineHeight=
"16px"
noWrap
{
...
props
}
/>
)
}
}
export
function
Subhead2
(
props
:
TextProps
)
{
export
function
Subhead2
(
props
:
TextProps
)
{
return
<
TextWrapper
className=
"subhead subhead-2"
fontSize=
{
14
}
fontWeight=
{
500
}
lineHeight=
"14px"
{
...
props
}
/>
return
(
<
TextWrapper
className=
"subhead subhead-2"
fontSize=
{
14
}
fontWeight=
{
500
}
lineHeight=
"14px"
noWrap
{
...
props
}
/>
)
}
}
export
function
Body1
(
props
:
TextProps
)
{
export
function
Body1
(
props
:
TextProps
)
{
...
@@ -48,19 +59,25 @@ export function Caption(props: TextProps) {
...
@@ -48,19 +59,25 @@ export function Caption(props: TextProps) {
}
}
export
function
Badge
(
props
:
TextProps
)
{
export
function
Badge
(
props
:
TextProps
)
{
return
<
TextWrapper
className=
"badge"
fontSize=
{
8
}
fontWeight=
{
600
}
lineHeight=
"8px"
{
...
props
}
/>
return
<
TextWrapper
className=
"badge"
fontSize=
{
8
}
fontWeight=
{
600
}
lineHeight=
"8px"
noWrap
/>
}
}
export
function
ButtonLarge
(
props
:
TextProps
)
{
export
function
ButtonLarge
(
props
:
TextProps
)
{
return
<
TextWrapper
className=
"button button-large"
fontSize=
{
20
}
fontWeight=
{
500
}
lineHeight=
"20px"
{
...
props
}
/>
return
(
<
TextWrapper
className=
"button button-large"
fontSize=
{
20
}
fontWeight=
{
500
}
lineHeight=
"20px"
noWrap
{
...
props
}
/>
)
}
}
export
function
ButtonMedium
(
props
:
TextProps
)
{
export
function
ButtonMedium
(
props
:
TextProps
)
{
return
<
TextWrapper
className=
"button button-medium"
fontSize=
{
16
}
fontWeight=
{
500
}
lineHeight=
"16px"
{
...
props
}
/>
return
(
<
TextWrapper
className=
"button button-medium"
fontSize=
{
16
}
fontWeight=
{
500
}
lineHeight=
"16px"
noWrap
{
...
props
}
/>
)
}
}
export
function
ButtonSmall
(
props
:
TextProps
)
{
export
function
ButtonSmall
(
props
:
TextProps
)
{
return
<
TextWrapper
className=
"button button-small"
fontSize=
{
14
}
fontWeight=
{
500
}
lineHeight=
"14px"
{
...
props
}
/>
return
(
<
TextWrapper
className=
"button button-small"
fontSize=
{
14
}
fontWeight=
{
500
}
lineHeight=
"14px"
noWrap
{
...
props
}
/>
)
}
}
export
function
TransitionButton
(
props
:
TextProps
&
{
buttonSize
:
'
small
'
|
'
medium
'
|
'
large
'
})
{
export
function
TransitionButton
(
props
:
TextProps
&
{
buttonSize
:
'
small
'
|
'
medium
'
|
'
large
'
})
{
...
@@ -73,6 +90,7 @@ export function TransitionButton(props: TextProps & { buttonSize: 'small' | 'med
...
@@ -73,6 +90,7 @@ export function TransitionButton(props: TextProps & { buttonSize: 'small' | 'med
fontSize=
{
fontSize
}
fontSize=
{
fontSize
}
fontWeight=
{
500
}
fontWeight=
{
500
}
lineHeight=
{
lineHeight
}
lineHeight=
{
lineHeight
}
noWrap
{
...
props
}
{
...
props
}
/>
/>
)
)
...
...
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