Skip to content

Commit

Permalink
add object for title margin
Browse files Browse the repository at this point in the history
  • Loading branch information
MargoMarm committed Sep 18, 2023
1 parent aacfdf9 commit d0577cd
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 11 deletions.
8 changes: 5 additions & 3 deletions src/components/ParamsForm/ParamsForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Formik, Form } from 'formik';
import PropTypes from 'prop-types';
import * as Yup from 'yup';
import { colors as palette } from '../../utils';
import { mg } from '../../utils';

import { Swiper, SwiperSlide } from 'swiper/react';
import 'swiper/css';
Expand Down Expand Up @@ -37,6 +38,7 @@ let paramsSchema = Yup.object({
levelActivity: Yup.string().required(),
});


const ParamsForm = ({ setSteps, setSwiperRef }) => {
return (
<Formik
Expand Down Expand Up @@ -64,7 +66,7 @@ const ParamsForm = ({ setSteps, setSwiperRef }) => {
onSwiper={setSwiperRef}
>
<SwiperSlide>
<Title text={'Get closer to your goals!'} margin={14} />
<Title text={'Get closer to your goals!'} margin={mg} />

<SubTitle
text={
Expand Down Expand Up @@ -122,7 +124,7 @@ const ParamsForm = ({ setSteps, setSwiperRef }) => {
</SwiperSlide>

<SwiperSlide>
<Title text={'Get closer to your goals!'} margin={28} />
<Title text={'Get closer to your goals!'} margin={mg} />

<FormControl style={{ marginBottom: '28px' }}>
<FormRadioBtnGroupWrapper>
Expand Down Expand Up @@ -422,7 +424,7 @@ const ParamsForm = ({ setSteps, setSwiperRef }) => {
/>
</SwiperSlide>
<SwiperSlide>
<Title text={'Dear user'} margin={14} />
<Title text={'Dear user'} margin={mg} />

<SubTitle
text={
Expand Down
2 changes: 1 addition & 1 deletion src/components/Title/Title.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Title = ({ text, margin }) => {

Title.propTypes = {
text: PropTypes.string,
margin: PropTypes.number,
margin: PropTypes.object,
};

export default Title;
8 changes: 4 additions & 4 deletions src/components/Title/Title.styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ export const StyledTitle = styled.h2`
font-weight: 700;
line-height: 1.05;
letter-spacing: 0.38px;
margin-bottom: ${props => props.margin}px;
margin-bottom: ${props => props.margin.bt.mob}px;
${mq.tablet} {
margin-bottom: ${props => props.margin + 2}px;
margin-top: 105px;
margin-bottom: ${props => props.margin.bt.tab}px;
margin-top: ${props => props.margin.top.tab}px;
font-size: 32px;
line-height: 1.11;
letter-spacing: 0.7px;
}
${mq.desktop} {
margin-top: 116px;
margin-top: ${props => props.margin.top.desk}px;
}
`;
3 changes: 2 additions & 1 deletion src/pages/SignIn/SignIn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import BtnSubtitle from '../../components/BtnSubtitle/BtnSubtitle';
import { Wrapper } from '../Home/Home.styled';
import { useDispatch } from 'react-redux';
import { logInUser } from '../../redux/auth/operation';
import {mg} from '../../utils'

const SignIn = () => {
const dispatch = useDispatch();
Expand All @@ -18,7 +19,7 @@ const SignIn = () => {
return (
<Wrapper>
<Header />
<Title text={'Sign In'} margin={14} />
<Title text={'Sign In'} margin={mg} />
<SubTitle
text={
'Welcome! Please enter your credentials to login to the platform:'
Expand Down
7 changes: 6 additions & 1 deletion src/pages/SignUp/SignUp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@ import { authUser } from '../../redux/auth/operation';
import BtnSubtitle from '../../components/BtnSubtitle/BtnSubtitle';
import { Wrapper } from '../Home/Home.styled';

import { mg } from '../../utils';


const SignUp = () => {
const dispatch = useDispatch();
const handleSubmit = (user, { resetForm }) => {
console.log(user);
dispatch(authUser(user));
resetForm();
};



return (
<Wrapper>
<Header />
<Title text={'Sign Up'} margin={14} />
<Title text={'Sign Up'} margin={mg} />
<SubTitle
text={
'Thank you for your interest in our platform. To complete the registration process, please provide us with the following information.'
Expand Down
4 changes: 3 additions & 1 deletion src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ export { default as colors } from './colorVeriables'
export { default as mq } from './mediaQuery'
export { default as button } from './customBtn'
export { default as svgUser } from './svgUser'
export {default as pageContentToRender} from './pageContentToRender'
export { default as pageContentToRender } from './pageContentToRender'
export { default as mg } from './titleMargins';

12 changes: 12 additions & 0 deletions src/utils/titleMargins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const mg = {
top: {
desk: 116,
tab: 105,
},
bt: {
tab: 16,
mob: 14,
},
};

export default mg

0 comments on commit d0577cd

Please sign in to comment.