Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 5320eb5

Browse files
authored
Merge pull request #57 from agile-ts/newdessign
Newdessign
2 parents c751c58 + 5ab8489 commit 5320eb5

File tree

49 files changed

+156
-42
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+156
-42
lines changed

docusaurus.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ const config = {
4949
projectName: 'agilets',
5050
themes: ['@docusaurus/theme-live-codeblock'],
5151
plugins: [
52-
'docusaurus-plugin-sass' /* @docusaurus/plugin-google-analytics (Not necessary because it automatically gets added) */,
52+
'docusaurus-plugin-sass',
53+
// @docusaurus/plugin-google-analytics (Not necessary because it automatically gets added)
5354
],
5455
customFields: { ...customFields },
5556
themeConfig: {
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { animated, useSpring } from 'react-spring';
2+
import React, { useEffect, useState } from 'react';
3+
import { useAgile } from '@agile-ts/react';
4+
import core from '../../../../../../core';
5+
import styles from './styles.module.css';
6+
import clsx from 'clsx';
7+
8+
type Props = { className?: string };
9+
10+
const Astronaut: React.FC<Props> = (props) => {
11+
const { className } = props;
12+
const [timing] = useState(200);
13+
const [isRaised, setIsRaised] = React.useState(false);
14+
const animated_Astronaut = useSpring({
15+
transform: isRaised ? `translateY(-${30}px)` : `translateY(0px)`,
16+
config: {
17+
mass: 1,
18+
tension: 400,
19+
friction: 15,
20+
},
21+
});
22+
const dark = useAgile(core.ui.ASTRONAUT_DARK);
23+
24+
useEffect(() => {
25+
if (!isRaised) {
26+
return;
27+
}
28+
29+
const timeoutId = setTimeout(() => {
30+
core.ui.toggleAstronautColor(!dark);
31+
setIsRaised(false);
32+
}, timing);
33+
34+
return () => clearTimeout(timeoutId);
35+
}, [isRaised, timing]);
36+
37+
const trigger = () => setIsRaised(true);
38+
39+
return (
40+
<div className={clsx(styles.Container, className)}>
41+
<animated.img
42+
onMouseEnter={trigger}
43+
style={animated_Astronaut}
44+
className={styles.Image}
45+
src={`img/astronaut-${dark ? 'dark' : 'light'}.svg`}
46+
alt={'Astronaut'}
47+
/>
48+
<div className={styles.Text}>Poke me 👆 to mutate my color State.</div>
49+
</div>
50+
);
51+
};
52+
53+
export default Astronaut;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.Container {
2+
display: flex;
3+
flex-direction: column;
4+
align-items: flex-end;
5+
}
6+
7+
.Text {
8+
color: var(--ifm-color-on-background-2);
9+
margin-top: 30px;
10+
align-self: center;
11+
}
12+
13+
.Image {
14+
width: 100%;
15+
max-width: 800px;
16+
}

0 commit comments

Comments
 (0)