Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
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
vicotor
frontend
Commits
63cb7c14
Commit
63cb7c14
authored
Aug 16, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skeleton new animation
parent
c039398d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
Skeleton.ts
theme/components/Skeleton.ts
+11
-5
No files found.
theme/components/Skeleton.ts
View file @
63cb7c14
import
{
Skeleton
as
SkeletonComponent
}
from
'
@chakra-ui/react
'
;
import
{
keyframes
}
from
'
@chakra-ui/system
'
;
import
type
{
SystemStyleFunction
}
from
'
@chakra-ui/theme-tools
'
;
import
{
getColor
,
mode
}
from
'
@chakra-ui/theme-tools
'
;
const
fade
=
(
startColor
:
string
,
endColor
:
string
)
=>
const
shine
=
(
)
=>
keyframes
({
from
:
{
borderColor
:
startColor
,
background
:
startColor
},
to
:
{
borderColor
:
endColor
,
background
:
endColor
},
to
:
{
backgroundPositionX
:
'
-200%
'
},
});
const
baseStyle
:
SystemStyleFunction
=
(
props
)
=>
{
...
...
@@ -26,8 +26,9 @@ const baseStyle: SystemStyleFunction = (props) => {
opacity
:
1
,
borderRadius
:
'
base
'
,
borderColor
:
start
,
background
:
end
,
animation
:
`
${
speed
}
s linear infinite alternate
${
fade
(
start
,
end
)
}
`
,
background
:
`linear-gradient(90deg,
${
start
}
8%,
${
end
}
18%,
${
start
}
33%)`
,
backgroundSize
:
'
200% 100%
'
,
animation
:
`
${
speed
}
s linear infinite
${
shine
()
}
`
,
};
};
...
...
@@ -36,3 +37,8 @@ const Skeleton = {
};
export
default
Skeleton
;
SkeletonComponent
.
defaultProps
=
{
...
SkeletonComponent
.
defaultProps
,
speed
:
1
,
};
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