Skip to content

Commit

Permalink
Merge pull request #405 from code-dot-org/ben/guide-continue-icon-click
Browse files Browse the repository at this point in the history
Add "click to continue" reminder animation
  • Loading branch information
bencodeorg authored Jul 15, 2024
2 parents a37464c + 287e312 commit d7cd203
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"jsx"
],
"moduleNameMapper": {
".+\\.(bin|jpg|jpeg|png|mp3|ogg|wav|gif)$": "identity-obj-proxy",
".+\\.(bin|jpg|jpeg|png|mp3|ogg|wav|gif|svg|css)$": "identity-obj-proxy",
"^@ml(.*)$": "<rootDir>/src/$1",
"^@public(.*)$": "<rootDir>/public/$1"
},
Expand Down
3 changes: 3 additions & 0 deletions public/images/finger-click-icon-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions public/images/finger-click-icon-2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
button {
padding: 1.5% 3%;
}

#pondTextMarkdown p {
margin: 0
}
Expand Down Expand Up @@ -106,6 +106,14 @@
font-size: calc(18px * 1024 / 930);
}
}
@media screen and (min-width: 1422px) and (min-height: 830px) {
#container {
max-width: 1280px;
}
#container-react {
font-size: calc(18px * 1280 / 930);
}
}
</style>
</head>
<body>
Expand Down
46 changes: 35 additions & 11 deletions src/oceans/components/common/Guide.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React from 'react'
import Radium from "radium";
import Typist from "react-typist";
import React from 'react';
import Radium from 'radium';
import Typist from 'react-typist';

import {getState, setState} from "@ml/oceans/state";
import guide from "@ml/oceans/models/guide";
import soundLibrary from "@ml/oceans/models/soundLibrary";
import styles from "@ml/oceans/styles";
import colors from "@ml/oceans/styles/colors";
import I18n from "@ml/oceans/i18n";
import {Button} from "@ml/oceans/components/common";
import arrowDownImage from "@public/images/arrow-down.png";
import '@ml/oceans/styles/fade.css';

import {getState, setState} from '@ml/oceans/state';
import guide from '@ml/oceans/models/guide';
import soundLibrary from '@ml/oceans/models/soundLibrary';
import styles from '@ml/oceans/styles';
import colors from '@ml/oceans/styles/colors';
import I18n from '@ml/oceans/i18n';
import {Button} from '@ml/oceans/components/common';
import arrowDownImage from '@public/images/arrow-down.png';
import fingerClickIcon1 from '@public/images/finger-click-icon-1.svg';
import fingerClickIcon2 from '@public/images/finger-click-icon-2.svg';

let UnwrappedGuide = class Guide extends React.Component {
onShowing() {
Expand Down Expand Up @@ -48,6 +52,12 @@ let UnwrappedGuide = class Guide extends React.Component {
setState({guideTypingTimer});
}

const renderClickToContinueReminder =
state.guides === 'K5' &&
state.guideShowing &&
!currentGuide.noDimBackground &&
currentGuide.style !== 'Info';

return (
<div>
{currentGuide && currentGuide.image && (
Expand Down Expand Up @@ -98,6 +108,20 @@ let UnwrappedGuide = class Guide extends React.Component {
{currentGuide.textFn(getState())}
</div>
</div>
{renderClickToContinueReminder && (
<div style={styles.guideClickToContinueReminderContainer}>
<img
src={fingerClickIcon1}
alt=""
style={styles.guideClickToContinueReminder1}
/>
<img
src={fingerClickIcon2}
alt=""
style={styles.guideClickToContinueReminder2}
/>
</div>
)}
{currentGuide.style === 'Info' && (
<Button style={styles.infoGuideButton} onClick={() => {}}>
{I18n.t('continue')}
Expand Down
17 changes: 17 additions & 0 deletions src/oceans/styles/fade.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@keyframes fadein {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}

@keyframes blink {
0%, 45% {
opacity: 0;
}
55%, 100% {
opacity: 1;
}
}
22 changes: 20 additions & 2 deletions src/oceans/styles/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import colors from "@ml/oceans/styles/colors";
import colors from '@ml/oceans/styles/colors';

const styles = {
body: {
Expand Down Expand Up @@ -507,6 +507,24 @@ const styles = {
padding: 20,
opacity: 0
},
guideClickToContinueReminderContainer: {
position: 'absolute',
right: '1%',
bottom: 0,
width: '5%',
minWidth: 25,
height: 15,
animation: '0.25s ease-in 4s 1 normal backwards running fadein'
},
guideClickToContinueReminder1: {
width: '100%',
position: 'absolute'
},
guideClickToContinueReminder2: {
animation: '1s linear 0.5s infinite normal none running blink',
width: '100%',
position: 'absolute'
},
guideBackground: {
backgroundColor: 'rgba(0,0,0,0.3)',
position: 'absolute',
Expand Down Expand Up @@ -589,4 +607,4 @@ const styles = {
}
};

export default styles
export default styles;
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const commonConfig = {
]
},
{
test: /\.(png|gif)$/,
test: /\.(png|gif|svg)$/,
loader: 'url-loader',
options: {
limit: 8192,
Expand Down

0 comments on commit d7cd203

Please sign in to comment.