diff --git a/src/components/login/login.jsx b/src/components/login/login.jsx index 58586e5e5..2f4180398 100644 --- a/src/components/login/login.jsx +++ b/src/components/login/login.jsx @@ -75,7 +75,10 @@ class Login extends React.Component { key="submitButton" type="submit" > - + ] : [ diff --git a/src/components/modal/addtostudio/studio-button.jsx b/src/components/modal/addtostudio/studio-button.jsx index 3a19ac5de..bfeb35147 100644 --- a/src/components/modal/addtostudio/studio-button.jsx +++ b/src/components/modal/addtostudio/studio-button.jsx @@ -1,28 +1,36 @@ const PropTypes = require('prop-types'); const React = require('react'); const classNames = require('classnames'); + const Spinner = require('../../spinner/spinner.jsx'); +const AnimateHOC = require('./animate-hoc.jsx'); require('./modal.scss'); const StudioButton = ({ hasRequestOutstanding, - id, includesProject, title, - onToggleStudio + onClick, + wasClicked }) => { const checkmark = ( checkmark-icon ); const plus = ( plus-icon ); @@ -34,8 +42,7 @@ const StudioButton = ({ {'studio-selector-button-selected': includesProject && !hasRequestOutstanding} )} - data-id={id} - onClick={onToggleStudio} + onClick={onClick} >
{(hasRequestOutstanding ? - () : + : (includesProject ? checkmark : plus))}
@@ -63,10 +70,10 @@ const StudioButton = ({ StudioButton.propTypes = { hasRequestOutstanding: PropTypes.bool, - id: PropTypes.number, includesProject: PropTypes.bool, - onToggleStudio: PropTypes.func, - title: PropTypes.string + onClick: PropTypes.func, + title: PropTypes.string, + wasClicked: PropTypes.bool }; -module.exports = StudioButton; +module.exports = AnimateHOC(StudioButton); diff --git a/src/components/modal/report/modal.jsx b/src/components/modal/report/modal.jsx index 7271458fd..e376398f5 100644 --- a/src/components/modal/report/modal.jsx +++ b/src/components/modal/report/modal.jsx @@ -224,7 +224,7 @@ class ReportModal extends React.Component { > {isWaiting ? (
- +
) : ( diff --git a/src/components/spinner/spinner.jsx b/src/components/spinner/spinner.jsx index 694f5a18e..cf723ba6c 100644 --- a/src/components/spinner/spinner.jsx +++ b/src/components/spinner/spinner.jsx @@ -1,29 +1,28 @@ -const range = require('lodash.range'); -const PropTypes = require('prop-types'); const React = require('react'); +const PropTypes = require('prop-types'); +const classNames = require('classnames'); require('./spinner.scss'); // Adapted from http://tobiasahlin.com/spinkit/ const Spinner = ({ - mode -}) => { - const spinnerClassName = (mode === 'smooth' ? 'spinner-smooth' : 'spinner'); - const spinnerDivCount = (mode === 'smooth' ? 24 : 12); - return ( -
- {range(1, spinnerDivCount + 1).map(id => ( -
- ))} -
- ); + className, + color +}) => ( + loading animation +); + +Spinner.defaultProps = { + color: 'white' }; Spinner.propTypes = { - mode: PropTypes.string + className: PropTypes.string, + color: PropTypes.oneOf(['white', 'blue', 'transparent-gray']) }; module.exports = Spinner; diff --git a/src/components/spinner/spinner.scss b/src/components/spinner/spinner.scss index 2707d02cf..4aba6ad98 100644 --- a/src/components/spinner/spinner.scss +++ b/src/components/spinner/spinner.scss @@ -1,118 +1,44 @@ -@import "../../colors"; - -.spinner { - position: relative; - margin: 0 auto; - width: 20px; - height: 20px; - - .circle { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - - &:before { - display: block; - animation: circleFadeDelay 1.2s infinite ease-in-out both; - margin: 0 auto; - border-radius: 100%; - background-color: $ui-gray; - width: 15%; - height: 15%; - content: ""; - - .white & { - background-color: $ui-blue-dark; - } - } - } - - @for $i from 1 through 12 { - $rotation: 30deg * ($i - 1); - $delay: -1.3s + $i * .1; - - .circle#{$i} { - transform: rotate($rotation); - - &:before { - animation-delay: $delay; - } - } - - } - +.studio-status-icon-spinner { + /* This class can be used on an icon that should spin. + It first plays the intro animation, then spins forever. */ + animation-name: intro, spin; + animation-duration: .25s, .5s; + animation-timing-function: cubic-bezier(.3, -3, .6, 3), linear; + animation-delay: 0s, .25s; + animation-iteration-count: 1, infinite; + animation-direction: normal; + width: 1.4rem; /* standard is 1.4 rem but can be overwritten by parent */ + height: 1.4rem; + -webkit-animation-name: intro, spin; + -webkit-animation-duration: .25s, .5s; + -webkit-animation-iteration-count: 1, infinite; + -webkit-animation-delay: 0s, .25s; + -webkit-animation-timing-function: cubic-bezier(.3, -3, .6, 3), linear; + transform-origin: center; } -@keyframes circleFadeDelay { - 0%, - 39%, +@keyframes intro { + 0% { + transform: scale(0); + opacity: 0; + -webkit-transform: scale(0); + } + 100% { - opacity: 0; - } - - 40% { + transform: scale(1); opacity: 1; + -webkit-transform: scale(1); } } - -/*********************/ -/* type === "smooth" */ -/*********************/ - -.spinner-smooth { - position: relative; - margin: 0 auto; - width: 20px; - height: 20px; - - .circle { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - - &:before { - display: block; - animation: circleFadeDelaySmooth 1.8s infinite ease-in-out both; - margin: 0 auto; - border-radius: 100%; - background-color: $ui-white; - width: 30%; - height: 20%; - content: ""; - - .white & { - background-color: darken($ui-blue, 8%); - } - } +@keyframes spin { + 0% { + transform: rotate(0); + -webkit-transform: rotate(0); } - @for $i from 1 through 24 { - $rotation: 15deg * ($i - 1); - $delay: -1.9s + $i * .075; - - .circle#{$i} { - transform: rotate($rotation); - - &:before { - animation-delay: $delay; - } - } - - } - -} - -@keyframes circleFadeDelaySmooth { - 0%, - 35% { - opacity: 0; - }, - 40% { - opacity: 1; + 100% { + transform: rotate(359deg); + -webkit-transform: rotate(359deg); } } diff --git a/src/views/components/components.jsx b/src/views/components/components.jsx index 3196d93ea..1e01bc4cc 100644 --- a/src/views/components/components.jsx +++ b/src/views/components/components.jsx @@ -35,8 +35,10 @@ const Components = () => ( -

This is a Spinner

- +

This is a blue Spinner

+

Colors

$ui-blue diff --git a/src/views/preview/preview.jsx b/src/views/preview/preview.jsx index 6b3fe2909..5ee45f1a1 100644 --- a/src/views/preview/preview.jsx +++ b/src/views/preview/preview.jsx @@ -208,8 +208,8 @@ class Preview extends React.Component { ); } } - handleToggleStudio (event) { - const studioId = parseInt(event.currentTarget.dataset.id, 10); + handleToggleStudio (id) { + const studioId = parseInt(id, 10); if (isNaN(studioId)) { // sanity check in case event had no integer data-id return; } diff --git a/src/views/studentcompleteregistration/studentcompleteregistration.jsx b/src/views/studentcompleteregistration/studentcompleteregistration.jsx index 6724ac87b..c5f3fc104 100644 --- a/src/views/studentcompleteregistration/studentcompleteregistration.jsx +++ b/src/views/studentcompleteregistration/studentcompleteregistration.jsx @@ -75,7 +75,7 @@ class StudentCompleteRegistration extends React.Component { } handleRegister (formData) { this.setState({waiting: true}); - + formData = defaults({}, formData || {}, this.state.formData); const submittedData = { birth_month: formData.user.birth.month, @@ -87,7 +87,7 @@ class StudentCompleteRegistration extends React.Component { if (this.props.must_reset_password) { submittedData.password = formData.user.password; } - + api({ host: '', uri: '/classes/student_update_registration/', diff --git a/static/svgs/modal/spinner-blue.svg b/static/svgs/modal/spinner-blue.svg new file mode 100644 index 000000000..effd69142 --- /dev/null +++ b/static/svgs/modal/spinner-blue.svg @@ -0,0 +1,10 @@ + + + + spinner-blue + Created with Sketch. + + + + + \ No newline at end of file diff --git a/static/svgs/modal/spinner-transparent-gray.svg b/static/svgs/modal/spinner-transparent-gray.svg new file mode 100644 index 000000000..e12923e26 --- /dev/null +++ b/static/svgs/modal/spinner-transparent-gray.svg @@ -0,0 +1,10 @@ + + + + spinner-transparent-gray + Created with Sketch. + + + + + \ No newline at end of file diff --git a/static/svgs/modal/spinner-white.svg b/static/svgs/modal/spinner-white.svg new file mode 100644 index 000000000..547b591dc --- /dev/null +++ b/static/svgs/modal/spinner-white.svg @@ -0,0 +1,10 @@ + + + + spinner-white + Created with Sketch. + + + + + \ No newline at end of file diff --git a/static/svgs/modal/spinner.svg b/static/svgs/modal/spinner.svg deleted file mode 100644 index b6a2b26f1..000000000 --- a/static/svgs/modal/spinner.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file