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

Commit

Permalink
refactor(my-diary): add background ui component
Browse files Browse the repository at this point in the history
affects: @my-diary/app, @fragments/main-page-header, @practice/my-diary, @ui/background, @ui/icons

ISSUES CLOSED: #77
  • Loading branch information
ikorol3107 committed May 18, 2021
1 parent 1652036 commit 9fa68fb
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 75 deletions.
1 change: 1 addition & 0 deletions practice/my-diary/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@store/notes": "0.0.0",
"@store/search-value": "0.0.0",
"@store/show-drawer": "0.0.0",
"@ui/background": "0.0.0",
"@ui/button": "0.0.0",
"@ui/drawer": "0.0.0",
"@ui/icons": "0.0.0",
Expand Down
15 changes: 4 additions & 11 deletions practice/my-diary/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { FilterProvider } from '@store/filter'
import { NotesProvider } from '@store/notes'
import { SearchValueProvider } from '@store/search-value'
import { ShowDrawerProvider } from '@store/show-drawer'
import { Box, Column, Layout } from '@ui/layout'
import { Background } from '@ui/background'
import { Column, Layout } from '@ui/layout'

export const App = () => {
const [notes, setNotes] = useState([])
Expand All @@ -24,15 +25,7 @@ export const App = () => {
<SearchValueProvider value={[searchValue, setSearchValue]}>
<FilterProvider value={[filter, setFilter]}>
<ShowDrawerProvider value={[showDrawer, setShowDrawer]}>
<Box
width='100%'
height='100%'
justifyContent='center'
backgroundColor='purple'
top='0'
left='0'
position='fixed'
>
<Background>
<Column width='600px'>
<Layout flexBasis={100} />
<MainPageHeader />
Expand All @@ -44,7 +37,7 @@ export const App = () => {
</Column>
<Layout flexBasis={50} />
</Column>
</Box>
</Background>
</ShowDrawerProvider>
</FilterProvider>
</SearchValueProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { useIntl } from 'react-intl'

import { HamburgerButtonIcon } from '@ui/icons'
import { BurgerButtonIcon } from '@ui/icons'
import { Box, Column, Layout, Row } from '@ui/layout'
import { Space, Text } from '@ui/text'
import { useNotes } from '@store/notes'
Expand All @@ -17,7 +17,7 @@ export const MainPageHeader = () => {
<Column>
<Row backgroundColor='deepPurple' lineHeights='giant' alignItems='center'>
<Layout flexBasis={50} />
<HamburgerButtonIcon cursor='pointer' onClick={() => setShowDrawer(true)} />
<BurgerButtonIcon cursor='pointer' onClick={() => setShowDrawer(true)} />
<Layout flexBasis={220} />
<Column>
<Layout flexBasis={20} />
Expand Down
14 changes: 14 additions & 0 deletions practice/my-diary/ui/background/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@ui/background",
"version": "0.0.0",
"license": "MIT",
"main": "src/index.ts",
"devDependencies": {
"@types/styled-system": "^5.1.10"
},
"dependencies": {
"@emotion/react": "^11.1.5",
"@emotion/styled": "^11.1.5",
"styled-system": "^5.1.0"
}
}
21 changes: 21 additions & 0 deletions practice/my-diary/ui/background/src/Background.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import styled from '@emotion/styled'
import { color, flexbox, layout } from 'styled-system'

export const Background = styled.div(
() => ({
height: '100%',
width: '100%',
top: '0',
left: '0',
position: 'fixed',
display: 'flex',
}),
color,
layout,
flexbox,
)

Background.defaultProps = {
justifyContent: 'center',
backgroundColor: 'purple',
}
1 change: 1 addition & 0 deletions practice/my-diary/ui/background/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Background'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 0 additions & 30 deletions practice/my-diary/ui/icons/icons/circleDot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */
import React from 'react'
export const HamburgerButtonIcon = (props) => (
export const BurgerButtonIcon = (props) => (
<svg width='50px' height='50px' viewBox='0 0 384 384' fill={props.color || '#fff'} {...props}>
<rect x='0' y='277.333' width='384' height='42.667' />
<rect x='0' y='170.667' width='384' height='42.667' />
Expand Down
2 changes: 1 addition & 1 deletion practice/my-diary/ui/icons/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './TrashIcon'
export * from './StarIcon'
export * from './HeartIcon'
export * from './HamburgerButtonIcon'
export * from './BurgerButtonIcon'
export * from './CircleDotIcon'
export * from './DotIcon'

0 comments on commit 9fa68fb

Please sign in to comment.