Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue-05] create Spinning Hero #18

Merged
merged 3 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/images/artwork-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/artwork-2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions src/stories/components/SpinningImages/SpinningImages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import './styles.scss';
import Artwork1 from '../../../images/artwork-1.svg';
import Artwork2 from '../../../images/artwork-2.svg';
import React from 'react';

/**
* Component for button element.
*
* @component
* @return {object} (
* <SpinningImages />
* )
*/
export const SpinningImages = () => {
const imageArray = [
Artwork1,
Artwork2,
];

return (
<div className="spinning-images">
{ imageArray.map((image, i) =>
<img className="spinninng-images__image"
key={i} src={image} alt="Decorative Artwork" />)
}
</div>
);
};
15 changes: 15 additions & 0 deletions src/stories/components/SpinningImages/SpinningImages.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { SpinningImages } from './SpinningImages';

/**
* Example Component: SpinningImages
*/
export default {
title: 'Example/SpinningImages',
component: SpinningImages,
};

const Template = (args) => <SpinningImages {...args} />;

// Default spinning featured image
export const Default = Template.bind({});
48 changes: 48 additions & 0 deletions src/stories/components/SpinningImages/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@import '../../../scss/variables.scss';

// @file
// Spinning Images

.spinning-images {
animation: rotation 10s infinite cubic-bezier(0.25, 0.75, 0.5, 1.25);
transform-origin: bottom center;
position: absolute;

@include bp-desktop {
height: rem(400px);
width: rem(600px);
}
}

.spinninng-images__image {
left: 0;
position: absolute;

&:first-child {
bottom: 0;
}

&:last-child {
// margin-top: -2px;
top: 100%;
transform: rotate(-180deg);
}
}

@keyframes rotation {
25% {
transform: rotate(0deg);
}

50% {
transform: rotate(-180deg);
}

75% {
transform: rotate(-180deg);
}

100% {
transform: rotate(-359deg);
}
}