• Stars
    star
    644
  • Rank 69,893 (Top 2 %)
  • Language
    JavaScript
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The landing page for Twizzle

🙋‍♂️ Made by @thekitze

Other projects:

  • 💻 Sizzy - A browser for designers and developers, focused on responsive design
  • 🏫 React Academy - Interactive React and GraphQL workshops
  • 🔮 Glink - Changelogs, Roadmap, User Requests
  • 🐶 Benji - Ultimate wellness and productivity platform
  • 🤖 JSUI - A powerful UI toolkit for managing JavaScript apps
  • 📹 YouTube Vlog - Follow my journey

Zero To Shipped


Twizzle

✉️️ Landing page for Twizzle, a desktop app for Twitter DM & composing tweets

🛠️ Setup

It's CRA 2 with customize-cra and react-app-rewired.
The config file is adding/changing the following:

  • Add babel-plugin-styled-components
  • Add inline-react-svg to inline svg files (I know CRA has this functionality but you import every file in a specific way)
  • Disable ESlint 🤷‍♂️

✅️ Main file

The magic happens in components/App/index.js

🐟️ Custom hooks

All of the hooks are in utils/hooks.js

  • useCanHover - detect if the device supports hover, if it doesn't, use onClick for the "tweeting" button
  • useToggleBodyClass - toggle a body class based on a boolean. Used to trigger dark/light and scroll/no-scroll classes on the body tag.
  • useGoogleAnalytics - inserts a google analytics script, but only when the app is ready
  • useMousePosition - track the mouse position. It's used to detect if the user is over the menu bar, otherwise the tweet composer gets glitchy.
  • useLoadScript - appends a script tag to the head of the page (used to load the Paddle script after the page is loaded)

I'll move these hooks to react-hanger soon.

🏝️ Desert background

  • I extracted all the logic for the background in a Background component
  • For the background I'm using 2 different svg images of a desert, a light one and a dark one.
  • I tried using them as background images, but they get all weird for some reason
  • They are switched using the DayNightToggle.
  • I'm using a desertLoaded boolean to detect when the dark image is completely loaded, and fade it in (otherwise it would look ugly on slow connections)
  • I'm waiting until the app is ready to start loading the light image, otherwise it's just slowing down the other requests for no reason

🍬️ Intro animation

  • All the animation logic is extracted in this custom hook
  • It's using react-pose for the animations
  • It's using sequence which is a function that I wrote for scheduling state changes. I also used it for the intro animation of ok-google.io. It goes through the arguments and if it finds a function it calls it, and if it finds a number it's gonna wait with setTimeout for the amount of ms. There is more info in this article.
  • It's always enabled in production, but it can be turned off in development using a boolean

🌓️ Day/night switch

It's really nothing fancy, just couple of styled divs. I feel a bit guilty because it's completely inaccessible by keyboard users.

z-index

So, z-index has been driving me crazy for a long time, so I decided to simplify the logic by ordering all elements in an order array and then using ...zIndexFor(ELEMENTS.COMPOSE) in the styles for the component that needs z-index. Smooth.

🖌️ Theming

  • The app has a dark and a light mode, and all the logic for them is in styles/themes.js.

  • Other components can use the themes either by destructuring the theme prop, or with the following mixins:

  • whenTheme - It applies style only when the certain theme name is active. Example: whenTheme('dark', {backgroundColor: 'black})

  • applyTheme - It applies certain theme styles to the element. Example: applyTheme('windowBar') will get the theme.windowBar styles from the current theme

  • getThemeColor - It reads a certain color from the current theme. Example: getThemeColor('icon') will return the icon color for the current theme.

⁉️ AMA

Just open an issue if you're interested about anything else in the app, and I'll add it in the readme.

More Repositories

1

JSUI

A powerful UI toolkit for managing JavaScript apps
JavaScript
4,244
star
2

react-hanger

A collection of useful React hooks
TypeScript
1,935
star
3

awesome-conference-practices

Did you like anything in particular about a conference? Let's make an awesome list 🎉
1,050
star
4

react-genie

A set of React components for animating elements as they scroll into the viewport
TypeScript
747
star
5

mobx-router

A simple router for MobX + React apps
TypeScript
509
star
6

react-electron-example

An example of using React (create-react-app) with Electron
JavaScript
349
star
7

twizzle

A desktop app for Twitter DM & composing tweets from the menubar. Works on macOS, Windows, and Linux.
JavaScript
275
star
8

styles-debugger

A helper for visually debugging styles in CSS-in-JS
JavaScript
130
star
9

copy-lite

Copy to clipboard function with no dependencies
TypeScript
119
star
10

react-tiniest-router

The tiniest router for React, built with hooks
TypeScript
105
star
11

graphql-user

Reusable utility methods for GraphQL authentication in Node.js
TypeScript
104
star
12

react-long

A LongPress component for React
JavaScript
88
star
13

voice-command-list

Temporary repository for the voice-command-list project.
88
star
14

react-disable

A React component for disabling a section of an app
TypeScript
77
star
15

react-in-markdown

Render custom React components in Markdown
JavaScript
67
star
16

gtb

Gulp The Builder
JavaScript
40
star
17

twiwdev

This Week In Webdev
27
star
18

tired-of-webdev

26
star
19

kitze-js-helpers

JS helper functions
JavaScript
25
star
20

phone-browser

Source code for why-iphone-x
JavaScript
22
star
21

mobx-router-example

MobX router example
JavaScript
20
star
22

rttr

A tiny router for mobx-state-tree apps
JavaScript
13
star
23

shortcuts-to-icloud

Watch a folder with js shortcuts for Siri and transfer them to iCloud on every change
JavaScript
13
star
24

extension-twitter-no-views

Hides the annoying view count on Twitter with CSS
Shell
12
star
25

payment-gateway-calculator

A calculator for comparing fees and profit between different payment processor gateways
JavaScript
11
star
26

react-genie-emotion

Animations for using react-genie with emotion
TypeScript
9
star
27

styled-mixins

A collection of css-in-js mixins
TypeScript
9
star
28

apollo-react-user

Opinionated package for adding authentication to a React + Apollo app
TypeScript
8
star
29

kitze-sass-helpers

Helpful sass mixins for generating BEM syntax and making SASS development easier
CSS
6
star
30

react-plop

React templates for plop
JavaScript
6
star
31

prisma2-template

TypeScript
5
star
32

snakepong-gpt-4

snakepong game made by GPT-4
JavaScript
5
star
33

react-academy-labs-starter-2

JavaScript
4
star
34

mantine-layout-components

Horizontal, Vertical, and Grid components for Mantine
TypeScript
3
star
35

fakeGPT

generate fake screenshots of conversations with chatGPT
TypeScript
3
star
36

mobx-router-landing

A landing page for mobx-router
JavaScript
3
star
37

stylz

Mixins and helpers for writing styles in JS
JavaScript
3
star
38

react-genie-styled-components

A set of animations for using react-genie with styled-components
TypeScript
3
star
39

postgres-s3-backups

TypeScript
2
star
40

hello-github-actions

2
star
41

kitze

1
star
42

react-academy-graphpack-starter

JavaScript
1
star
43

electrontest

electron
JavaScript
1
star
44

kitze-react-plopfile

My plop setup for quickly generating react components
1
star