Skip to content
Open
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
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"pre-commit": "yarn -v"
},
"dependencies": {
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@mui/material": "^5.6.4",
"dotenv": "^11.0.0",
"firebase": "^9.6.1",
"firebase-tools": "^10.0.1",
Expand Down
28 changes: 28 additions & 0 deletions src/components/autoComplete/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import styles from './styles.module.scss';
import { Autocomplete, TextField } from '@mui/material';
import { IProps } from './types';

export const AutocompleteField = (
{
label,
options,
size = 'medium',
fullWidth = true,
className = styles.default,
sx = null,
renderInput,
disablePortal = true
}: IProps) => {

return (
<Autocomplete
disablePortal={disablePortal}
className={className}
options={options}
fullWidth={fullWidth}
size={size}
sx={sx}
renderInput={renderInput ? renderInput : (params) => <TextField {...params} label={label} />}
/>
)
}
14 changes: 14 additions & 0 deletions src/components/autoComplete/styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@import '../../styles/vars.scss';
@import '../../styles/fonts.scss';

.default fieldset {
border: 2px $color-focus-primary-dark solid !important;

}
.default > div > label {
color: $color-focus-secundary !important;
font-family: 'Noto-sans';
}
.default svg {
color: $color-focus-primary !important;
}
12 changes: 12 additions & 0 deletions src/components/autoComplete/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { SxProps, Theme } from "@mui/material"

export interface IProps {
label: string;
options: string[];
className?: string;
size?: 'medium' | 'small';
fullWidth?: boolean;
disablePortal?: boolean;
renderInput?: any;
sx?: SxProps<Theme>;
}
15 changes: 1 addition & 14 deletions src/components/postCardLine/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,9 @@
.tags {
margin-top: .5rem;
}

@media screen and (max-width: 50rem){
.postCard {
width: 85%;
padding: .75rem .5rem;
&__metadata {
width: calc(5rem + 20vw);
}
&__article {
width: 100%;
}
}
}
@media screen and (max-width: 35rem){
.postCard {
width: 100%;
width: 95%;

&__metadata {
width: 14rem;
Expand Down
8 changes: 6 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import PostCardBlock from '../components/postCardBlock'
import { dataExample } from './posts/models/data'
import styles from './style.module.scss'
import { useSizes } from '../hooks/useSizes'
import '../service/initFirebase'
// import '../service/initFirebase'
import Link from 'next/link'
import { AutocompleteField } from '../components/autoComplete';

const Home: NextPage = () => {
const { width } = useSizes()
Expand All @@ -20,7 +21,10 @@ const Home: NextPage = () => {
</Head>
<Header sticky/>
<main>
{ width/16 < 30 ?
<form className={styles.filter}>
<AutocompleteField label='Tag' options={dataExample.Tags} size="small" className={styles.box} sx={{width: '9rem'}}/>
</form>
{ width/16 < 40 ?
<>
<PostCardBlock className={styles.postCard} data={dataExample}/>
<PostCardBlock className={styles.postCard} data={dataExample}/>
Expand Down
26 changes: 26 additions & 0 deletions src/pages/style.module.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
@import '../styles/vars.scss';

.filter {
display: flex;
align-items: center;
justify-content: space-evenly;

width: 40rem;
height: 8rem;
margin: 2rem auto 0 auto;
padding-block: 2rem;

box-shadow: $box-shadow-blocks;
}

.postCard {
margin: 3rem auto;
}

@media screen and (max-width: 50rem){
.filter {
width: 95%;
height: 8rem;
margin: 2rem auto 0 auto;
padding-block: 2rem;

box-shadow: $box-shadow-blocks;
}
}
Loading