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 some global components #2

Merged
merged 3 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
. "$(dirname -- "$0")/_/husky.sh"

yarn prettier
git add .
47 changes: 0 additions & 47 deletions components/BackgroundCard.tsx

This file was deleted.

15 changes: 15 additions & 0 deletions components/Button/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
interface Props {
text: JSX.Element | string
onClick: any
}

const CopyButton = ({ text, onClick }: Props) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cần có type/option để ra nhiều kiểu hơn

return (
<>
{text}
<a onClick={onClick} className="money money-sm copy-icon sm-margin-left-xs" />
</>
)
}

export default CopyButton
12 changes: 12 additions & 0 deletions components/Card/Background/BackgroundCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import styles from './style.module.scss'

interface Props {
children: React.ReactElement
}

const BackgroundCard = ({ children }: Props) => {
return <div className={styles.backgroundCard}>{children}</div>
}

export default BackgroundCard
1 change: 1 addition & 0 deletions components/Card/Background/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './BackgroundCard'
22 changes: 22 additions & 0 deletions components/Card/Background/style.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.backgroundCard {
box-sizing: border-box;

/* Auto layout */

/* White Color/50 */

background: var(--border-color);
/* White Color/50 */

border: 1px solid var(--border-color);
backdrop-filter: blur(42px);
/* Note: backdrop-filter has minimal browser support */

border-radius: 16px;

/* Inside auto layout */

flex: none;
order: 0;
flex-grow: 0;
}
25 changes: 25 additions & 0 deletions components/Card/Layout/ItemsCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import BackgroundCard from '../Background/BackgroundCard'

interface ItemComponent {
label: string
content: JSX.Element | string
}

interface Props {
items: ItemComponent[]
}

const ItemsCard = ({ items }: Props) => {
return (
<BackgroundCard>
{items.map((item: ItemComponent) => (
<Row key={item.label}>
<div className={styles.cardLabel}>{item.label}</div>
<div className={styles.cardContent}>{item.content}</div>
</Row>
))}
</BackgroundCard>
)
}

export default ItemsCard
9 changes: 9 additions & 0 deletions components/Card/Layout/StaticsCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import styles from './style.module.scss'

interface Props {}

const StaticsCard = ({ items }: Props) => {
return <div className={styles.staticsCard}></div>
}

export default StaticsCard
13 changes: 13 additions & 0 deletions components/Card/Layout/style.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.itemsCard {
display: flex;
flex-direction: column;
align-items: flex-start;

padding: 48px 32px;
}

.cardLabel {
}

.cardContent {
}
8 changes: 4 additions & 4 deletions components/Navbar/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import clsx from 'clsx'
import cloneDeep from 'lodash/cloneDeep'
import Link from 'next/link'
import { useRef, useState } from 'react'
import cloneDeep from 'lodash/cloneDeep'

import styles from './style.module.scss'
import useOutsideAlerter from '../../hooks/useOutsideElement'
import { useRouter } from 'next/router'
import Image from 'next/image'
import { useRouter } from 'next/router'
import useOutsideAlerter from '../../hooks/useOutsideElement'
import styles from './style.module.scss'
type MenuType = 'static' | 'locale'

type SubMenuItem = {
Expand Down
Empty file removed components/PageTitle.tsx
Empty file.
13 changes: 13 additions & 0 deletions components/Row/BackgroundRow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react'
import clsx from 'clsx'
import styles from './style.module.scss'

interface Props {
children: JSX.Element[]
}

const BackgroundRow = ({ children }: Props) => {
return <div className={clsx(styles.row, styles.blockRow, styles.backgroundRow)}>{children}</div>
}

export default BackgroundRow
20 changes: 20 additions & 0 deletions components/Row/GradientRow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react'
import clsx from 'clsx'
import styles from './style.module.scss'
import RowType from './RowType'

interface Props {
children: JSX.Element[]
type: 'success' | 'error'
}

const GradientRow = ({ children, type }: Props) => {
return (
<div className={clsx(styles.row, styles.blockRow, styles.gradientRow)}>
<RowType type={type} />
{children}
</div>
)
}

export default GradientRow
13 changes: 13 additions & 0 deletions components/Row/Row.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import clsx from 'clsx'
import styles from './style.module.scss'

interface Props {
className?: string[]
children: JSX.Element[]
}

const Row = ({ children, className = [] }: Props) => {
return <div className={clsx(styles.row, ...className)}>{children}</div>
}

export default Row
14 changes: 14 additions & 0 deletions components/Row/RowType.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react'
import clsx from 'clsx'
import styles from './style.module.scss'

interface Props {
type: 'success' | 'error'
}

const RowType = ({ type }: Props) => {
const style = type === 'success' ? styles.success : styles.error
return <div className={clsx(styles.rowType, style)}></div>
}

export default RowType
2 changes: 2 additions & 0 deletions components/Row/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './GradientRow'
export * from './BackgroundRow'
53 changes: 53 additions & 0 deletions components/Row/style.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.row {
display: flex;
flex-direction: row;
flex: 1;
}

.blockRow {
box-sizing: border-box;
height: 72px;

/* White Color/50 */

/* Note: backdrop-filter has minimal browser support */
border-radius: 16px;

/* Inside auto layout */

padding: 12px 28px;
flex: none;
order: 0;
flex-grow: 0;
}

.backgroundRow {
background: var(--border-color);
/* White Color/50 */
border: 1px solid var(--border-color);
backdrop-filter: blur(42px);
}

.gradientRow {
background: linear-gradient(90deg, rgba(139, 255, 98, 0.08) 0%, rgba(97, 181, 67, 0) 10.65%),
rgba(255, 255, 255, 0.05);
border: 1px solid var(--border-color);
backdrop-filter: blur(42px);
}

.rowType {
position: absolute;
width: 4px;
height: 32px;
left: 0px;
top: 20px;
border-radius: 0px 4px 4px 0px;
}

.success {
background: var(--alert-color-success);
}

.error {
background: var(--alert-color-error);
}
37 changes: 37 additions & 0 deletions components/Table/Table.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// import styles from './style.module.scss'

// interface ColumeType {
// dataIndex: string
// key: string
// }

// interface Props {
// dataSource: object[],
// columns: ColumeType[]
// }

// const Table = ({ headers, rows }: Props) => {
// return (
// <table className={styles.table}>
// <tr>
// {headers.map((header: JSX.Element | string) => (
// <th className={styles.tableHeader}>{header}</th>
// ))}
// </tr>
// {/* {rows.map(row) => (
// <tr>
// <td>Alfreds Futterkiste</td>
// <td>Maria Anders</td>
// <td>Germany</td>
// </tr>
// )} */}
// <tr>
// <td>Centro comercial Moctezuma</td>
// <td>Francisco Chang</td>
// <td>Mexico</td>
// </tr>
// </table>
// )
// }

// export default Table
9 changes: 9 additions & 0 deletions components/Table/styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.table {
box-sizing: border-box;

// background: var(--border-color);
/* White Color/100 */

border: 1px solid var(--same-color-theme-10);
border-radius: 8px;
}
27 changes: 27 additions & 0 deletions components/Tabs/Tab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import clsx from 'clsx'
import styles from './style.module.scss'

interface Props {
active: boolean
title: string
onClick?: any
}

const BorderActive = () => <div className={styles.borderActive} />

const Tab = ({ active, title, onClick }: Props) => {
if (active)
return (
<a onClick={onClick} className={clsx(styles.tab, styles.tabActive, 'text', 'text-base')}>
<span>{title}</span>
<BorderActive />
</a>
)
return (
<a onClick={onClick} className={clsx(styles.tab, 'text', 'text-base')}>
<span>{title}</span>
</a>
)
}

export default Tab
Loading