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

feat: add storybook and animated planet component #2

Merged
merged 3 commits into from
Apr 4, 2024

Conversation

shadowusr
Copy link
Member

@shadowusr shadowusr commented Apr 3, 2024

What's done

  • Installed storybook
  • Implemented the AnimatedPlanet component, which will be used on the main page. Tested that it runs smoothly in Chrome, Firefox and Safari
  • Set up github action for deploying static to S3. Currently to my personal bucket, but we can change that at any time just by editing a couple of secrets

One issue remains — website currently displays incorrectly; page renders twice. That maybe fixed later, maybe in another PR.

@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from 8525ffa to 6d8ff93 Compare April 3, 2024 21:04
@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from 6d8ff93 to d08ff78 Compare April 3, 2024 21:10
@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from d08ff78 to 6765b21 Compare April 3, 2024 21:12
@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from 6765b21 to 4297c9d Compare April 3, 2024 21:29
Copy link

github-actions bot commented Apr 3, 2024

✅ Successfully deployed static

@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from 4297c9d to f3ebe15 Compare April 3, 2024 21:36
@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from f3ebe15 to 0d1bf72 Compare April 3, 2024 21:38
@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from 0d1bf72 to 8dcd33a Compare April 3, 2024 21:43
@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from 8dcd33a to c35f8b5 Compare April 3, 2024 21:52
@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from c35f8b5 to 00e7462 Compare April 3, 2024 21:55
@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from 00e7462 to 2b3403a Compare April 4, 2024 07:47
@@ -60,7 +60,7 @@ const config: Config = {
position: "left",
label: "Tutorial",
},
{ to: "/blog", label: "Blog", position: "left" },
{ to: "#", label: "Blog", position: "left" },
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docusaurus detects broken links. Since we don't have /blog and other pages yet, it won't build successfully. Changed broken links to # for now.

scale: number;
}

export function useResizableSvg(
Copy link
Member Author

@shadowusr shadowusr Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't adequately resize svg, if you use paths in it as offset-path (motion path) for other elements. We use trail paths as motion paths for planes, so if svg with trails resizes planes would move along the wrong directory.

There are two ways to circumvent this: use transform scale with resize observer or re-calculate paths via d3.js with resize observer. Scale seems easier and more lightweight.

This hook provides a transform scale-based solution.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we use a hack to keep this planet png size below 20KB, making it extremely lightweight. In order for it to not be blurry on high-res displays we use clip-path to cut a perfect circle contour, so it appears to be high-res.

@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1452.planet-animation branch from 2b3403a to 7dfd643 Compare April 4, 2024 08:05
.storybook/main.ts Outdated Show resolved Hide resolved
src/components/AnimatedPlanet/hooks/useAnimatedStar.ts Outdated Show resolved Hide resolved
src/components/AnimatedPlanet/hooks/useAnimatedPlane.ts Outdated Show resolved Hide resolved
src/components/AnimatedPlanet/hooks/useAnimatedTrail.ts Outdated Show resolved Hide resolved
src/typings/index.d.ts Show resolved Hide resolved
@miripiruni
Copy link
Member

@shadowusr Super good!

I have question about https://storage.yandexcloud.net/testplane-ci/testplane-docs/website-static/8551288637-17-1/index.html — imho there is a bug, page is duplicated.

@shadowusr
Copy link
Member Author

I have question about https://storage.yandexcloud.net/testplane-ci/testplane-docs/website-static/8551288637-17-1/index.html — imho there is a bug, page is duplicated.

Yeah, that's a bug, I mentioned it in the PR description. I'm going to address it in the next PR, because it's not linked to current changes.

Still not sure why this is happening. Definitely related to server side rendering (when I turn it off, page renders just fine). But the most weird thing about it is that if I serve the exact same bundle locally, page renders correctly. After uploading to S3, this happens. Not the first time, same thing happened with a different bucket and different docusaurus project.

@shadowusr shadowusr merged commit b6020ff into master Apr 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants