feat: Author Datetime bug: CheckboxCommon

This commit is contained in:
quangnhankie 2021-08-26 09:23:01 +07:00
parent 188232e5e3
commit 3d27832080
11 changed files with 78 additions and 13 deletions

3
next-env.d.ts vendored
View File

@ -1,6 +1,3 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@ -74,7 +74,6 @@
"prettier": "^2.3.0",
"typescript": "4.3.4"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"prettier --write",

View File

@ -1,6 +1,6 @@
import { CarouselCommon, LabelCommon, Layout, QuanittyInput,CheckboxCommon } from 'src/components/common'
import { CarouselCommon, LabelCommon, Layout, QuanittyInput,CheckboxCommon ,Author,DateTime} from 'src/components/common'
import imgAuthor from '../src/components/common/Author/img/author.png';
const dataTest = [{
text: 1
}, {
@ -18,8 +18,9 @@ const test = (props: { text: string }) => <div className="h-64 bg-yellow-300">{p
export default function Home() {
return (
<>
<CheckboxCommon defaultChecked={true}></CheckboxCommon>
<Author image={imgAuthor} name="Alessandro Del Piero"></Author>
<DateTime date="april 30,2021"></DateTime>
</>
)
}

View File

@ -0,0 +1,17 @@
.authorWarper{
@apply flex flex-row items-center;
.authorImage{
width:3.2rem;
height:3.2rem;
border-radius:3.2rem;
}
.authorName{
margin-left:1rem;
color:var(--text-label);
font-family: var(--font-sans);
font-size: 1.2rem;
line-height: 2rem;
font-feature-settings: 'salt' on;
}
}

View File

@ -0,0 +1,21 @@
import React from 'react';
import s from './Author.module.scss';
import classNames from 'classnames';
import Image from "next/image";
interface Props {
image:any,
name: string
}
const Author = ({image,name}:Props) =>{
return (
<div className={classNames(s.authorWarper)}>
<Image className={classNames(s.authorImage)} src={image} alt=""/>
<div className={classNames(s.authorName)}>{name}</div>
</div>
)
}
export default Author;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,12 +1,11 @@
@import '../../../styles/utilities';
.checkboxCommonWarper{
@apply flex flex-col;
margin-left:2rem;
.checkboxItem{
display: block;
position: relative;
cursor: pointer;
margin-top:2rem;
border-radius: 0.4rem;
width:50%;
&:hover .checkboxInput ~ .checkMark {
@ -62,5 +61,10 @@
}
.checkboxText{
margin-left:3rem;
font-size:1.2rem;
line-height: 2rem;
font-family: var(--font-sans);
color:var(--text-base);
letter-spacing: 0.01em;
}
}

View File

@ -1,4 +1,4 @@
import React,{useState,useEffect} from 'react';
import React,{ChangeEvent,useState,useEffect} from 'react';
import s from './CheckboxCommon.module.scss';
import classNames from 'classnames';
@ -12,7 +12,7 @@ interface CheckboxProps extends Omit<
const CheckboxCommon = ({onChange,defaultChecked = true,...props}: CheckboxProps) =>{
const [value, setValue] = useState<boolean>();
const [value, setValue] = useState<boolean>(true);
useEffect(()=>{
onChange && onChange(value)
@ -31,7 +31,7 @@ const CheckboxCommon = ({onChange,defaultChecked = true,...props}: CheckboxProps
<span className={s.checkMark}></span>
</label>
<div className={classNames(s.checkboxText)}>
<label for="check"> Billing address is same as shipping </label>
<label htmlFor="check"> Billing address is same as shipping </label>
</div>
</div>
)

View File

@ -0,0 +1,9 @@
.dateTime{
color:var(--text-label);
text-transform: uppercase;
font-size: 1.2rem;
line-height: 2rem;
letter-spacing: 0.01em;
font-feature-settings: 'salt' on;
font-family: var(--font-sans);
}

View File

@ -0,0 +1,15 @@
import React from 'react';
import s from './DateTime.module.scss';
import classNames from 'classnames';
interface Props {
date:string,
}
const DateTime = ({date}:Props) =>{
return (
<div className={classNames(s.dateTime)}>{date}</div>
)
}
export default DateTime;

View File

@ -8,4 +8,6 @@ export { default as ViewAllItem} from './ViewAllItem/ViewAllItem'
export { default as ItemWishList} from './ItemWishList/ItemWishList'
export { default as Logo} from './Logo/Logo'
export { default as Inputcommon} from './InputCommon/InputCommon'
export { default as CheckboxCommon} from './CheckboxCommon/CheckboxCommon'
export { default as CheckboxCommon} from './CheckboxCommon/CheckboxCommon'
export { default as Author} from './Author/Author'
export { default as DateTime} from './DateTime/DateTime'