Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
ed604a21
Commit
ed604a21
authored
Sep 07, 2018
by
Linda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add studio buttons animation on preview page, need fixing
parent
3c6530fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
122 additions
and
36 deletions
+122
-36
src/components/modal/addtostudio/animate-hoc.jsx
src/components/modal/addtostudio/animate-hoc.jsx
+34
-0
src/components/modal/addtostudio/modal.scss
src/components/modal/addtostudio/modal.scss
+64
-27
src/components/modal/addtostudio/studio-button.jsx
src/components/modal/addtostudio/studio-button.jsx
+24
-9
No files found.
src/components/modal/addtostudio/animate-hoc.jsx
0 → 100644
View file @
ed604a21
const
React
=
require
(
'
react
'
);
const
PropTypes
=
require
(
'
prop-types
'
);
/**
* Higher-order component for building an animated studio button
* @param {React.Component} Component a studio button component
* @return {React.Component} a wrapped studio button component
*/
const
AnimateHOC
=
({
Component
})
=>
{
class
WrappedComponent
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
let
wasClicked
=
false
;
}
onClick
()
{
this
.
wasClicked
=
true
;
// BUT PROPS ARE READONLY?
}
render
()
{
return
(<
Component
wasClicked=
{
this
.
wasClicked
}
{
...
this
.
props
}
/>);
}
}
return
WrappedComponent
;
};
AnimateHOC
.
propTypes
=
{
Component
:
PropTypes
.
element
};
src/components/modal/addtostudio/modal.scss
View file @
ed604a21
...
...
@@ -89,7 +89,6 @@
pointer-events
:
none
;
/* pass clicks through to buttons underneath */
}
.studio-selector-button
{
display
:
flex
;
position
:
relative
;
...
...
@@ -102,6 +101,7 @@
height
:
2
.5rem
;
box-sizing
:
border-box
;
justify-content
:
space-between
;
transition
:
all
.5s
;
}
.studio-selector-button-text
{
...
...
@@ -164,30 +164,67 @@
background-color
:
$ui-blue
;
}
.studio-status-icon-plus-img
{
width
:
1
.4rem
;
height
:
1
.4rem
;
}
.studio-status-icon--img
{
width
:
1
.4rem
;
height
:
1
.4rem
;
}
.action-button-text
.spinner-smooth
{
margin
:
.2125rem
auto
;
width
:
1
.875rem
;
height
:
1rem
;
}
.studio-status-icon
.spinner-smooth
{
position
:
unset
;
/* don't understand why neither relative nor absolute work */
}
.studio-status-icon
.spinner-smooth
.circle
{
/* overlay spinner on circle */
position
:
absolute
;
margin
:
.1875rem
;
/* stay within boundaries of circle */
width
:
75%
;
/* stay within boundaries of circle */
height
:
75%
;
/* stay within boundaries of circle */
.studio-status-icon-plus-img
,
.studio-status-icon-checkmark-img
,
.studio-status-icon-spinner
{
width
:
1
.4rem
;
height
:
1
.4rem
;
transform-origin
:
center
;
animation-direction
:
normal
;
}
.studio-status-icon-with-animation
{
animation-duration
:
.25s
;
animation-name
:
bump
;
animation-iteration-count
:
1
;
animation-timing-function
:
cubic-bezier
(
0
.3
,
-3
,
0
.6
,
3
);
}
.studio-status-icon-spinner
{
animation-name
:
bump
,
spin
;
-webkit-animation-name
:
bump
,
spin
;
animation-duration
:
.25s
,
.5s
;
-webkit-animation-duration
:
.25s
,
.5s
;
animation-iteration-count
:
1
,
infinite
;
-webkit-animation-iteration-count
:
1
,
infinite
;
animation-delay
:
0s
,
.25s
;
-webkit-animation-delay
:
0s
,
.25s
;
animation-timing-function
:
cubic-bezier
(
0
.3
,
-3
,
0
.6
,
3
)
,
ease-in-out
;
-webkit-animation-timing-function
:
cubic-bezier
(
0
.3
,
-3
,
0
.6
,
3
)
,
ease-in-out
;
}
@keyframes
intro
{
0
%
{
transform
:
scale
(
0
);
-webkit-transform
:
scale
(
0
);
opacity
:
0
;
}
100
%
{
transform
:
scale
(
1
);
-webkit-transform
:
scale
(
1
);
opacity
:
1
;
}
}
@keyframes
bump
{
0
%
{
transform
:
scale
(
0
);
-webkit-transform
:
scale
(
0
);
opacity
:
0
;
}
100
%
{
transform
:
scale
(
1
);
-webkit-transform
:
scale
(
1
);
opacity
:
1
;
}
}
@keyframes
spin
{
0
%
{
transform
:
rotate
(
0
);
-webkit-transform
:
rotate
(
0
);
}
100
%
{
transform
:
rotate
(
359deg
);
-webkit-transform
:
rotate
(
359deg
);
}
}
src/components/modal/addtostudio/studio-button.jsx
View file @
ed604a21
const
PropTypes
=
require
(
'
prop-types
'
);
const
React
=
require
(
'
react
'
);
const
classNames
=
require
(
'
classnames
'
);
const
Spinner
=
require
(
'
../../spinner/spinner.jsx
'
);
const
AnimateHOC
=
require
(
'
./animate-hoc
'
);
require
(
'
./modal.scss
'
);
...
...
@@ -10,19 +10,33 @@ const StudioButton = ({
id
,
includesProject
,
title
,
onToggleStudio
onToggleStudio
,
wasClicked
})
=>
{
const
checkmark
=
(
<
img
alt=
"checkmark-icon"
className=
"studio-status-icon-checkmark-img"
className=
{
classNames
(
{
'
studio-status-icon-with-animation
'
:
true
},
'
studio-status-icon-checkmark-img
'
)
}
src=
"/svgs/modal/confirm.svg"
/>
);
const
spinner
=
(
<
img
alt=
"loading animation"
className=
"studio-status-icon-spinner"
src=
"/svgs/modal/spinner.svg"
/>
);
const
plus
=
(
<
img
alt=
"plus-icon"
className=
"studio-status-icon-plus-img"
className=
{
classNames
(
{
'
studio-status-icon-with-animation
'
:
true
},
'
studio-status-icon-plus-img
'
)
}
src=
"/svgs/modal/add.svg"
/>
);
...
...
@@ -45,16 +59,16 @@ const StudioButton = ({
)
}
title=
{
title
}
>
{
title
}
{
title
}
{
wasClicked
}
</
div
>
<
div
className=
{
classNames
(
'
studio-status-icon
'
,
{
'
studio-status-icon-unselected
'
:
!
includesProject
}
{
'
studio-status-icon-unselected
'
:
!
includesProject
&&
!
hasRequestOutstanding
}
)
}
>
{
(
hasRequestOutstanding
?
(<
Spinner
mode=
"smooth"
/>)
:
spinner
:
(
includesProject
?
checkmark
:
plus
))
}
</
div
>
</
div
>
...
...
@@ -66,7 +80,8 @@ StudioButton.propTypes = {
id
:
PropTypes
.
number
,
includesProject
:
PropTypes
.
bool
,
onToggleStudio
:
PropTypes
.
func
,
title
:
PropTypes
.
string
title
:
PropTypes
.
string
,
wasClicked
:
PropTypes
.
bool
};
module
.
exports
=
StudioButton
;
module
.
exports
=
AnimateHOC
(
StudioButton
)
;
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