-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): implment basic content of new tab page (#5)
- Loading branch information
Showing
14 changed files
with
409 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import styled from '@emotion/styled' | ||
|
||
export const Root = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
user-select: none; | ||
` | ||
|
||
export const Date = styled.span` | ||
display: block; | ||
font-size: 28px; | ||
font-family: 'Azeret Mono', monospace; | ||
font-optical-sizing: auto; | ||
font-weight: 400; | ||
font-style: normal; | ||
text-align: center; | ||
color: rgba(255, 255, 255, 0.5); | ||
` | ||
|
||
export const Weather = styled(Date)` | ||
margin-top: 8px; | ||
font-size: 18px; | ||
` | ||
|
||
export const Time = styled.span` | ||
display: block; | ||
font-size: 94px; | ||
font-family: 'Azeret Mono', monospace; | ||
font-optical-sizing: auto; | ||
font-weight: 400; | ||
font-style: normal; | ||
color: rgba(255, 255, 255, 0.75); | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { useEffect, useState } from 'react' | ||
|
||
import dayjs from 'dayjs' | ||
|
||
import useAppStore from '@stores/app' | ||
|
||
import * as Styled from './Clock.styled' | ||
|
||
function Clock() { | ||
const [time, setTime] = useState(() => dayjs()) | ||
const weather = useAppStore((store) => store.weather?.weather) | ||
|
||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
setTime(dayjs()) | ||
}, 500) | ||
|
||
return () => { | ||
clearInterval(interval) | ||
} | ||
}, []) | ||
|
||
return ( | ||
<Styled.Root> | ||
<Styled.Time>{time.format('HH·mm·ss')}</Styled.Time> | ||
<Styled.Date>{time.format('YYYY·MM·DD')}</Styled.Date> | ||
{weather && ( | ||
<Styled.Weather> | ||
{weather.weatherName} {Math.round(weather.temperature * 10) / 10}°C | ||
</Styled.Weather> | ||
)} | ||
</Styled.Root> | ||
) | ||
} | ||
|
||
export default Clock |
Oops, something went wrong.