aboutsummaryrefslogtreecommitdiffstats
path: root/src/views/Landing/HomeHero.jsx
blob: f01d3350c660b1a3e9cfd07e96bfaeea111798a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/* eslint-disable tailwindcss/no-custom-classname */
// import { StyledButton } from '@/components/styled-button'
import { Button } from '@mui/joy'
import Typography from '@mui/joy/Typography'
import Box from '@mui/material/Box'
import Grid from '@mui/material/Grid'
import React, { useEffect } from 'react'
import { useNavigate } from 'react-router-dom'

import Logo from '@/assets/logo.svg'
import screenShotMyChore from '@/assets/screenshot-my-chore.png'
import { GitHub } from '@mui/icons-material'
import useWindowWidth from '../../hooks/useWindowWidth'

const HomeHero = () => {
  const navigate = useNavigate()
  const windowWidth = useWindowWidth()
  const windowThreshold = 600
  const HERO_TEXT_THAT = [
    // 'Donetick simplifies the entire process, from scheduling and reminders to automatic task assignment and progress tracking.',
    // 'Donetick is the intuitive task and chore management app designed for groups. Take charge of shared responsibilities, automate your workflow, and achieve more together.',
    'An open-source, user-friendly app for managing tasks and chores, featuring customizable options to help you and others stay organized',
  ]

  const [heroTextIndex, setHeroTextIndex] = React.useState(0)

  useEffect(() => {
    // const intervalId = setInterval(
    //   () => setHeroTextIndex(index => index + 1),
    //   4000, // every 4 seconds
    // )
    // return () => clearTimeout(intervalId)
  }, [])

  const Title = () => (
    <Box
      sx={{
        textAlign: 'center',
        display: 'flex',
        flexDirection: 'row',
        justifyContent: 'center',
        alignItems: 'center',
      }}
    >
      <img src={Logo} width={'100px'} />
      <Typography level='h1' fontSize={58} fontWeight={800}>
        <span
          data-aos-delay={50 * 1}
          data-aos-anchor='[data-aos-id-hero]'
          data-aos='fade-up'
        >
          Done
        </span>
        <span
          data-aos-delay={100 * 3}
          data-aos-anchor='[data-aos-id-hero]'
          data-aos='fade-up'
          style={{
            color: '#06b6d4',
          }}
        >
          tick
        </span>
      </Typography>
    </Box>
  )

  const Subtitle = () => (
    <Typography
      level='h2'
      fontWeight={500}
      textAlign={'center'}
      className='opacity-70'
      data-aos-delay={100 * 5}
      data-aos-anchor='[data-aos-id-hero]'
      data-aos='zoom-in'
    >
      Simplify Tasks & Chores, Together.
    </Typography>
  )

  const CTAButton = () => (
    <Button
      data-aos-delay={100 * 2}
      data-aos-anchor='[data-aos-id-hero]'
      data-aos='fade-up'
      variant='solid'
      size='lg'
      sx={{
        py: 1.25,
        px: 5,
        fontSize: 20,
        mt: 2,
        borderWidth: 3,
        // boxShadow: '0px 0px 24px rgba(81, 230, 221, 0.5)',
        transition: 'all 0.20s',
      }}
      className='hover:scale-105'
      onClick={() => {
        // if the url is donetick.com then navigate to app.donetick.com/my/chores
        // else navigate to /my/chores
        if (window.location.hostname === 'donetick.com') {
          window.location.href = 'https://app.donetick.com/my/chores'
        } else {
          navigate('/my/chores')
        }
      }}
    >
      Get started
    </Button>
  )

  return (
    // <Box
    //   id='hero'
    //   className='grid min-h-[90vh] w-full place-items-center px-4 py-12'
    //   data-aos-id-hero
    // >
    <Grid container spacing={16} sx={{ py: 12 }}>
      <Grid item xs={12} md={7}>
        <Title />
        <div className='flex flex-col gap-6'>
          <Subtitle />

          <Typography
            level='title-lg'
            textAlign={'center'}
            fontSize={28}
            // textColor={'#06b6d4'}
            color='primary'
            data-aos-delay={100 * 1}
            data-aos-anchor='[data-aos-id-hero]'
            data-aos='fade-up'
          >
            {`"${HERO_TEXT_THAT[heroTextIndex % HERO_TEXT_THAT.length]}"`}
          </Typography>

          <Box className='flex w-full justify-center'>
            <CTAButton />
            <Button
              data-aos-delay={100 * 2.5}
              data-aos-anchor='[data-aos-id-hero]'
              data-aos='fade-up'
              variant='soft'
              size='lg'
              sx={{
                py: 1.25,
                px: 5,
                ml: 2,
                fontSize: 20,
                mt: 2,
                borderWidth: 3,
                // boxShadow: '0px 0px 24px rgba(81, 230, 221, 0.5)',
                transition: 'all 0.20s',
              }}
              className='hover:scale-105'
              onClick={() => {
                // new window open to https://github.com/Donetick:
                window.open('https://github.com/donetick', '_blank')
              }}
              startDecorator={<GitHub />}
            >
              Github
            </Button>
          </Box>
        </div>
      </Grid>
      {windowWidth > windowThreshold && (
        <Grid item xs={12} md={5}>
          <div className='flex justify-center'>
            <img
              src={screenShotMyChore}
              width={'100%'}
              style={{
                maxWidth: 300,
              }}
              height={'auto'}
              alt='Hero img'
              data-aos-delay={100 * 2}
              data-aos-anchor='[data-aos-id-hero]'
              data-aos='fade-left'
            />
          </div>
        </Grid>
      )}
    </Grid>
  )
}

export default HomeHero