Skip to content

Commit

Permalink
add input field to profile section list
Browse files Browse the repository at this point in the history
  • Loading branch information
wbglaeser committed Jun 6, 2024
1 parent 88272f0 commit 236e9a9
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/screens/profile-section/ProfileSectionScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import Layout from "../../components/Layout";
import {useParams} from "react-router-dom";
import readJson from "../../utilities/readJson";
import ProfileSectionContext from "./components/ProfileSectionContext";
import ProfileSectionList from "./components/ProfileSectionList";

const ProfileSectionScreen = () => {
const { id } = useParams();
const {id} = useParams();
const [profileSectionData, setProfileSectionData] = useState();


Expand All @@ -31,7 +32,10 @@ const ProfileSectionScreen = () => {
return (
<Layout>
{profileSectionData ? (
<ProfileSectionContext title={profileSectionData.title} infoBox={id==='about-you'}/>)
<>
<ProfileSectionContext title={profileSectionData.title} infoBox={id === 'about-you'}/>
<ProfileSectionList profileSectionData={profileSectionData}/>
</>)
:
null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import HStack from "../../../components/HStack";
const ProfileSectionContext = ({title, infoBox}) => {

return (
<VStack>
<VStack gap={1} alignItems={'flex-start'}>
<VStack sx={{width: '100%'}}>
<VStack gap={1}>
<HStack>
<Typography variant="h4" gutterBottom sx={styles.titleText}>
{title}
Expand Down
62 changes: 62 additions & 0 deletions src/screens/profile-section/components/ProfileSectionList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react';
import {Card, CardContent, TextField, Typography} from '@mui/material';
import VStack from "../../../components/VStack";
import HStack from "../../../components/HStack";
import {yellow} from "@mui/material/colors";

const ProfileSectionList = ({profileSectionData}) => {

return (
<VStack sx={{width: '100%'}}>
<VStack gap={1}>
{
profileSectionData.fields.map((section) => {
return (
<VStack gap={1}>
<HStack>
<Card sx={styles.infoCard} data-testid="card">
<CardContent sx={styles.infoCardContent} data-testid="card-content">
<Typography variant="body1" gutterBottom sx={styles.titleText}>
{section.title}
</Typography>
</CardContent>
</Card>
</HStack>
<TextField
label="Username"
variant="outlined"
fullWidth
/>
</VStack>
)
})
}
</VStack>
</VStack>
);
};

const styles = {
titleText: {
fontWeight: 'bold',
margin: '0px'
},
infoCard: {
width: '100%',
borderRadius: '15px',
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: yellow[200],
boxShadow: 'none',
},
infoCardContent: {
padding: '16px',
"&:last-child": {
paddingBottom: '16px',
}
},
};

export default ProfileSectionList;

0 comments on commit 236e9a9

Please sign in to comment.