start normal disign
This commit is contained in:
parent
bd9b192656
commit
244aed205b
@ -5,7 +5,7 @@ import Laptop from '@shared/assets/icons/laptop.svg';
|
||||
const HomePage = () => {
|
||||
return (
|
||||
<div className={classes.home}>
|
||||
<Laptop width={250} height={250} />
|
||||
<Laptop className={classes.laptop} />
|
||||
<div className={classes.container}>
|
||||
<Form />
|
||||
</div>
|
||||
|
@ -1,13 +1,36 @@
|
||||
@use '../../shared/assets/styles/adaptive' as adaptive;
|
||||
|
||||
$adaptive: (
|
||||
desktop: (
|
||||
flex-direction: row,
|
||||
size: 250px,
|
||||
container-width: 768px
|
||||
),
|
||||
table: (
|
||||
flex-direction: row,
|
||||
size: 250px,
|
||||
container-width: 425px
|
||||
),
|
||||
mobile: (
|
||||
flex-direction: column,
|
||||
size: auto,
|
||||
container-width: auto
|
||||
),
|
||||
);
|
||||
|
||||
.home {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
@include adaptive.set-adaptive($adaptive, flex-direction, flex-direction);
|
||||
|
||||
.laptop {
|
||||
@include adaptive.set-adaptive($adaptive, width, size);
|
||||
@include adaptive.set-adaptive($adaptive, height, size);
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 15px;
|
||||
@include adaptive.container;
|
||||
@include adaptive.set-adaptive($adaptive, width, container-width);
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
$breakpoints: (
|
||||
desktop: (
|
||||
max: 1440px,
|
||||
min: 1024.1px
|
||||
max: 2560px,
|
||||
min: 1024px
|
||||
),
|
||||
table: (
|
||||
max: 1024px,
|
||||
min: 768.1px
|
||||
max: 1023.99px,
|
||||
min: 768px
|
||||
),
|
||||
mobile: (
|
||||
max: 768px,
|
||||
max: 767.99px,
|
||||
min: 375px
|
||||
),
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
:root {
|
||||
--primary-black: #040404;
|
||||
--transparent-black: rgba(0, 0, 0, 0.8);
|
||||
--primary-white: #ffffff;
|
||||
--secondary-gray: #D9D9D9;
|
||||
--active-color: #007AFF;
|
||||
--transparent-black: rgba(0, 0, 0, 0.8);
|
||||
}
|
17
src/shared/assets/styles/_theme.scss
Normal file
17
src/shared/assets/styles/_theme.scss
Normal file
@ -0,0 +1,17 @@
|
||||
@mixin shadows () {
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1),
|
||||
0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
@mixin hoverElement {
|
||||
background-color: var(--active-color);
|
||||
color: var(--primary-white);
|
||||
}
|
||||
|
||||
@mixin hoverBorder {
|
||||
border: 2px solid var(--active-color);
|
||||
}
|
||||
|
||||
@mixin hoverLink {
|
||||
color: var(--active-color);
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
import React, { FormEvent } from 'react';
|
||||
import React, { FormEvent, ReactNode } from 'react';
|
||||
import classes from './styles.module.scss';
|
||||
|
||||
type ButtonProps = {
|
||||
label: string;
|
||||
children: ReactNode;
|
||||
onClick: (e: FormEvent) => Promise<void>;
|
||||
};
|
||||
|
||||
const Button: React.FC<ButtonProps> = ({ label, onClick }) => {
|
||||
const Button: React.FC<ButtonProps> = ({ children, onClick }) => {
|
||||
return (
|
||||
<button className={classes.button} onClick={onClick}>
|
||||
{label}
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
@ -1,18 +1,19 @@
|
||||
@use '../../assets/styles/fonts' as fonts;
|
||||
@use '../../assets/styles/theme' as theme;
|
||||
|
||||
.button {
|
||||
background-color: var(--primary-white);
|
||||
border: 2px solid var(--secondary-gray); // белая обводка
|
||||
border-radius: 8px; // закруглённые углы
|
||||
border: none; // белая обводка
|
||||
border-radius: 2px 2px 16px 16px; // закруглённые углы
|
||||
color: var(--primary-black); // белый текст
|
||||
padding: 10px 20px; // внутренних отступов
|
||||
cursor: pointer; // курсор при наведении
|
||||
transition: 0.3s ease; // плавный переход фона
|
||||
transition: 0.3s ease;
|
||||
@include fonts.urbanist-font(20px, 600);
|
||||
@include theme.shadows();
|
||||
|
||||
&:hover {
|
||||
background-color: var(--active-color);
|
||||
color: var(--primary-white); // белый текст
|
||||
@include theme.hoverElement();
|
||||
}
|
||||
|
||||
&:focus {
|
||||
|
8
src/shared/components/devider/devider.component.tsx
Normal file
8
src/shared/components/devider/devider.component.tsx
Normal file
@ -0,0 +1,8 @@
|
||||
import { FC } from 'react';
|
||||
import classes from './styles.module.scss';
|
||||
|
||||
const Devider: FC = () => {
|
||||
return <div className={classes.devider} />;
|
||||
};
|
||||
|
||||
export default Devider;
|
1
src/shared/components/devider/index.ts
Normal file
1
src/shared/components/devider/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export { default as Devider } from './devider.component';
|
6
src/shared/components/devider/styles.module.scss
Normal file
6
src/shared/components/devider/styles.module.scss
Normal file
@ -0,0 +1,6 @@
|
||||
.devider {
|
||||
background-color: var(--secondary-gray);
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
border-radius: 50%;
|
||||
}
|
34
src/shared/components/expander/expander.component.tsx
Normal file
34
src/shared/components/expander/expander.component.tsx
Normal file
@ -0,0 +1,34 @@
|
||||
import { FC, ReactNode, useState } from 'react';
|
||||
import classes from './styles.module.scss';
|
||||
import { Devider } from '@shared/components/devider';
|
||||
|
||||
type ExpanderProps = {
|
||||
title: string;
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
const Expander: FC<ExpanderProps> = ({ title, children }) => {
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const handleHeaderClick = () => {
|
||||
setExpanded((expanded) => !expanded);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={classes.expander}>
|
||||
<div className={classes.header} onClick={handleHeaderClick}>
|
||||
<div className={classes.title}>{title}</div>
|
||||
<span className={classes.title}>{expanded ? '▼' : '❮'}</span>
|
||||
</div>
|
||||
<div
|
||||
className={
|
||||
expanded ? classes.contentExpanded : classes.contentCollapsed
|
||||
}
|
||||
>
|
||||
<Devider />
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Expander;
|
1
src/shared/components/expander/index.ts
Normal file
1
src/shared/components/expander/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export { default as Expander } from './expander.component';
|
41
src/shared/components/expander/styles.module.scss
Normal file
41
src/shared/components/expander/styles.module.scss
Normal file
@ -0,0 +1,41 @@
|
||||
@use '../../assets/styles/fonts' as fonts;
|
||||
@use '../../assets/styles/theme' as theme;
|
||||
|
||||
.expander {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
background-color: var(--primary-white);
|
||||
border: 2px solid var(--primary-white);
|
||||
border-radius: 16px;
|
||||
padding: 16px;
|
||||
transition: 0.3s ease;
|
||||
@include theme.shadows();
|
||||
|
||||
&:hover { @include theme.hoverBorder(); }
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
@include fonts.urbanist-font(26px, 600);
|
||||
}
|
||||
}
|
||||
|
||||
.contentExpanded {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
filter: opacity(1);
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.contentCollapsed {
|
||||
display: none;
|
||||
filter: opacity(0);
|
||||
height: 0;
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@ const Selector: FC<SelectorProps> = ({ field, handleSetValue, list }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={classes.selectorContainer}>
|
||||
<select
|
||||
className={classes.selector}
|
||||
onChange={handleChange}
|
||||
@ -32,7 +31,6 @@ const Selector: FC<SelectorProps> = ({ field, handleSetValue, list }) => {
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -1,15 +1,22 @@
|
||||
@use '../../assets/styles/fonts' as fonts;
|
||||
@use '../../assets/styles/theme' as theme;
|
||||
|
||||
.selector {
|
||||
background-color: rgba(255, 255, 255, 0.2); // прозрачный белый
|
||||
border: 2px solid var(--primary-white); // белая рамка
|
||||
background-color: var(--primary-white); // прозрачный белый
|
||||
border: 2px solid var(--secondary-gray); // белая рамка
|
||||
border-radius: 8px; // закруглённые углы
|
||||
color: var(--primary-white); // белый текст
|
||||
color: var(--primary-black); // белый текст
|
||||
padding: 8px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
@include fonts.urbanist-font(20px, 600);
|
||||
@include theme.shadows();
|
||||
|
||||
option {
|
||||
background-color: rgba(255, 255, 255, 0.2); // цвет фона для выпадающего списка
|
||||
color: var(--primary-white); // белый текст в выпадающем списке
|
||||
}
|
||||
color: var(--primary-black); // белый текст в выпадающем списке
|
||||
}
|
||||
|
||||
&:hover { @include theme.hoverBorder(); }
|
||||
|
||||
&:focus { @include theme.hoverBorder(); }
|
||||
}
|
@ -13,5 +13,5 @@ export type PredictRequestType = {
|
||||
};
|
||||
|
||||
export type PredictResponseType = {
|
||||
predicted_price: number;
|
||||
predicted_price?: number;
|
||||
};
|
||||
|
@ -8,6 +8,7 @@ import classes from './styles.module.scss';
|
||||
import { Button } from '@/shared/components/button';
|
||||
import { Selector } from '@/shared/components/selector';
|
||||
import { mockUpOptions } from '@/shared/constants';
|
||||
import { Expander } from '@/shared/components/expander';
|
||||
|
||||
const Form = () => {
|
||||
const [request, setRequest] = useState<PredictRequestType>({
|
||||
@ -24,7 +25,7 @@ const Form = () => {
|
||||
display_type: '4K',
|
||||
});
|
||||
const [response, setResponse] = useState<PredictResponseType>({
|
||||
predicted_price: -1,
|
||||
predicted_price: undefined,
|
||||
});
|
||||
|
||||
const fields = Object.keys(request);
|
||||
@ -54,19 +55,17 @@ const Form = () => {
|
||||
<form className={classes.form}>
|
||||
<div className={classes.selectorList}>
|
||||
{fields.map((field) => (
|
||||
<Expander key={field} title={field}>
|
||||
<Selector
|
||||
key={field}
|
||||
handleSetValue={updateField}
|
||||
list={mockUpOptions[field]}
|
||||
field={field}
|
||||
/>
|
||||
</Expander>
|
||||
))}
|
||||
</div>
|
||||
<Button
|
||||
onClick={(e: FormEvent) => handleGetPredict(e)}
|
||||
label={'Submit'}
|
||||
/>
|
||||
{response && (
|
||||
<Button onClick={(e: FormEvent) => handleGetPredict(e)}>Submit</Button>
|
||||
{response.predicted_price && (
|
||||
<span style={{ color: 'white' }}>
|
||||
Ответ: {response.predicted_price}
|
||||
</span>
|
||||
|
@ -4,12 +4,10 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
background-color: var(--transparent-black);
|
||||
backdrop-filter: blur(10px);
|
||||
width: 100%;
|
||||
background-color: var(--secondary-gray);
|
||||
justify-content: center;
|
||||
padding: 25px;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
border-radius: 24px;
|
||||
|
||||
.selectorList {
|
||||
display: flex;
|
||||
|
@ -5,8 +5,8 @@ const Navbar = () => {
|
||||
<nav className={classes.navbar}>
|
||||
<div className={classes.container}>
|
||||
<div className={classes.logo}>
|
||||
<h2 className={classes.title}>Price Builder</h2>
|
||||
<span>v1.0.0</span>
|
||||
<h1 className={classes.title}>Price Builder</h1>
|
||||
<span className={classes.version}>v1.0.0</span>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
@ -1,11 +1,17 @@
|
||||
@use '../../shared/assets/styles/adaptive' as adaptive;
|
||||
@use '../../shared/assets/styles/fonts' as fonts;
|
||||
@use '../../shared/assets/styles/theme' as theme;
|
||||
|
||||
$adaptive: (
|
||||
|
||||
);
|
||||
|
||||
.navbar {
|
||||
display: flex;
|
||||
background-color: var(--transparent-black);
|
||||
backdrop-filter: blur(10px);
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
background-color: var(--secondary-gray);
|
||||
border-radius: 16px;
|
||||
margin: 16px;
|
||||
|
||||
.container {
|
||||
padding: 15px;
|
||||
@ -14,14 +20,27 @@
|
||||
.logo {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: start;
|
||||
justify-content: flex-start;
|
||||
align-items: end;
|
||||
gap: 8px;
|
||||
color: var(--primary-white);
|
||||
color: var(--primary-black);
|
||||
|
||||
.title {
|
||||
margin: 0;
|
||||
transition: 0.3s ease;
|
||||
@include fonts.urbanist-font(36px, 600);
|
||||
|
||||
&:hover { @include theme.hoverLink(); }
|
||||
}
|
||||
}
|
||||
|
||||
.version {
|
||||
background-color: var(--primary-white);
|
||||
color: var(--primary-black);
|
||||
border-radius: 25px;
|
||||
padding: 4px 16px;
|
||||
@include fonts.urbanist-font(20px, 500);
|
||||
@include theme.shadows();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user