-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from loxygenK/feat/more-animation
- Loading branch information
Showing
14 changed files
with
241 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import React from "react"; | ||
|
||
import { AppRouter } from "./pages/Router"; | ||
import { AppRouter } from "./pages/router/Router"; | ||
|
||
export const App = () => <AppRouter />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,47 @@ | ||
@use "~/styling/animation.module.scss"; | ||
@use "~/styling/color.module.scss"; | ||
|
||
$skew_original: -15deg; | ||
|
||
.wrapper { | ||
position: relative; | ||
|
||
padding: 0.5em 1.5em; | ||
overflow: hidden; | ||
|
||
border: 2px solid color.get-theme-color(text-color-accent-primary); | ||
line-height: 100%; | ||
vertical-align: center; | ||
vertical-align: middle; | ||
|
||
transition: 0.2s all; | ||
|
||
&:before { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
|
||
z-index: -1; | ||
content: ""; | ||
width: 110%; | ||
height: 100%; | ||
background: color.get-theme-color(background-alt); | ||
transform-origin: right top; | ||
transform: skewX($skew_original) scale(0, 1); | ||
transition: 0.4s transform; | ||
} | ||
|
||
&:hover { | ||
transform: scale(1.10); | ||
|
||
&:before { | ||
transform-origin: left top; | ||
transform: skewX($skew_original) scale(1, 1); | ||
} | ||
} | ||
|
||
&:active { | ||
transform: scale(1.05); | ||
} | ||
|
||
@include animation.hover; | ||
@include animation.click; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import React from "react"; | ||
import { Link } from "react-router-dom"; | ||
import styles from "./SimpleButton.module.scss"; | ||
|
||
export type SimpleButtonProps = { | ||
caption: string; | ||
linkTo: string; | ||
}; | ||
export const SimpleButton = ({ caption, linkTo }: SimpleButtonProps) => ( | ||
<a href={linkTo} className={styles.wrapper}> | ||
<Link to={linkTo} className={styles.wrapper}> | ||
<span>{caption}</span> | ||
</a> | ||
</Link> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
@use "~/styling/color.module.scss"; | ||
|
||
%transition-base { | ||
position: fixed; | ||
z-index: 1; | ||
|
||
&:before { | ||
transition: all 750ms; | ||
|
||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
z-index: 1; | ||
|
||
content: ""; | ||
width: 170%; | ||
height: 170%; | ||
background-color: color.get-theme-color(background-alt); | ||
} | ||
} | ||
|
||
.transition-enter { | ||
@extend %transition-base; | ||
|
||
&:before { | ||
transition-delay: 650ms; | ||
|
||
transform-origin: right top; | ||
transform: skewX(-15deg) scale(1, 1); | ||
} | ||
} | ||
|
||
.transition-enter-active { | ||
@extend %transition-base; | ||
|
||
&:before { | ||
transition-delay: 650ms; | ||
|
||
transform-origin: right top; | ||
transform: skewX(-15deg) scale(0, 1); | ||
} | ||
} | ||
|
||
.transition-exit { | ||
@extend %transition-base; | ||
|
||
&:before { | ||
transform-origin: left top; | ||
transform: skewX(-15deg) scale(0, 1); | ||
} | ||
} | ||
|
||
.transition-exit-active { | ||
@extend %transition-base; | ||
|
||
&:before { | ||
transform-origin: left top; | ||
transform: skewX(-15deg) scale(1, 1); | ||
} | ||
} | ||
|
||
.transition-exit-done { | ||
@extend %transition-base; | ||
|
||
&:before { | ||
transform-origin: left top; | ||
transform: skewX(-30deg) scale(0, 1); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from "react"; | ||
import { useLocation } from "react-router-dom"; | ||
import { TransitionGroup, CSSTransition } from "react-transition-group"; | ||
import { CSSTransitionClassNames } from "react-transition-group/CSSTransition"; | ||
|
||
import styles from "./TransitionAnimator.module.scss"; | ||
|
||
const transitionClassNames: CSSTransitionClassNames = { | ||
enter: styles.transitionEnter, | ||
enterActive: styles.transitionEnterActive, | ||
exit: styles.transitionExit, | ||
exitActive: styles.transitionExitActive, | ||
exitDone: styles.transitionExitDone, | ||
}; | ||
|
||
export type TransitionAnimatorProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
export const TransitionAnimator = ({ children }: TransitionAnimatorProps) => { | ||
const location = useLocation(); | ||
|
||
console.log(location.pathname); | ||
|
||
return ( | ||
<TransitionGroup> | ||
<CSSTransition | ||
key={location.pathname} | ||
timeout={{ | ||
exit: 750, | ||
enter: 1350, | ||
}} | ||
classNames={transitionClassNames} | ||
mountOnEnter | ||
unmountOnExit | ||
> | ||
{children} | ||
</CSSTransition> | ||
</TransitionGroup> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.