Skip to content
Snippets Groups Projects
Commit 4469ac45 authored by Daniel Pettersson's avatar Daniel Pettersson
Browse files

Refactoring changed merged successfully with current development stage of...

Refactoring changed merged successfully with current development stage of frontend. DASHBOARD: Newly added middle column in between map and visualiser which support functionality for region search and two options windows with menuitems selections
parent f3a903f1
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,8 @@ function TopNavBar() { ...@@ -5,8 +5,8 @@ function TopNavBar() {
return ( return (
<div className="top-nav"> <div className="top-nav">
<button className='sign_out_button'>Sign Out</button>
<h1 className='h1'>DASHBOARD</h1>
</div> </div>
); );
} }
......
import { styled } from '@mui/material/styles';
import Typography from '@mui/material/Typography';
import React from 'react';
const Wrapper = styled('div')(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-start',
gap: theme.spacing(1),
cursor: 'pointer', // Make the entire area clickable
}));
const SelectedText = styled(Typography)(({ theme, selected }) => ({
color: selected ? theme.palette.primary.main : theme.palette.text.primary,
fontWeight: selected ? 'bold' : 'normal',
}));
const options = ['Antal nominerade', 'Andel nominerade', 'Antal valda', 'Andel valda', 'Antal ej valda'];
function MultiSelectText() {
const [selectedValues, setSelectedValues] = React.useState([]);
const handleClick = (option) => {
const currentIndex = selectedValues.indexOf(option);
const newSelectedValues = [...selectedValues];
if (currentIndex === -1) {
newSelectedValues.push(option);
} else {
newSelectedValues.splice(currentIndex, 1);
}
setSelectedValues(newSelectedValues);
};
return (
<Wrapper>
{options.map((option) => (
<SelectedText
key={option}
onClick={() => handleClick(option)}
selected={selectedValues.includes(option)}
>
{option}
</SelectedText>
))}
</Wrapper>
);
}
export default MultiSelectText;
\ No newline at end of file
import { styled } from '@mui/material/styles';
import Typography from '@mui/material/Typography';
import React from 'react';
const Wrapper = styled('div')(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-start',
gap: theme.spacing(1),
cursor: 'pointer', // Make the entire area clickable
}));
const SelectedText = styled(Typography)(({ theme, selected }) => ({
color: selected ? theme.palette.primary.main : theme.palette.text.primary,
fontWeight: selected ? 'bold' : 'normal',
}));
const options = ['män', 'kvinnor', 'totalt'];
function MultiSelectText2() {
const [selectedValues, setSelectedValues] = React.useState([]);
const handleClick = (option) => {
const currentIndex = selectedValues.indexOf(option);
const newSelectedValues = [...selectedValues];
if (currentIndex === -1) {
newSelectedValues.push(option);
} else {
newSelectedValues.splice(currentIndex, 1);
}
setSelectedValues(newSelectedValues);
};
return (
<Wrapper>
{options.map((option) => (
<SelectedText
key={option}
onClick={() => handleClick(option)}
selected={selectedValues.includes(option)}
>
{option}
</SelectedText>
))}
</Wrapper>
);
}
export default MultiSelectText2;
\ No newline at end of file
.search_container{
display: flex;
flex-direction: column;
}
.multi_select{
margin: 5px;
margin-top: 20px;
border-style: solid;
padding: 2px;
}
\ No newline at end of file
import React from 'react'
import * as MUI from '@mui/material';
import MultiSelectText from './MultiSelectText'
import MultiSelectText2 from './MultiSelectText2';
import "./Search.css"
export const Searchbar = () => {
const provinceOptions = [
{ label: 'Stockholm', id: 1 },
{ label: 'Uppsala', id: 3 },
{ label: 'Södermanland', id: 4 },
{ label: 'Östergötland', id: 5 },
{ label: 'Jönköping', id: 6 },
{ label: 'Kronobergs', id: 7 },
{ label: 'Kalmar', id: 8 },
{ label: 'Gotland', id: 9 },
{ label: 'Blekinge', id: 10 },
{ label: 'Skåne', id: 12 },
{ label: 'Halland', id: 13 },
{ label: 'Västra Götaland', id: 14 },
{ label: 'Värmland', id: 17 },
{ label: 'Örebro', id: 18 },
{ label: 'Västmanland', id: 19 },
{ label: 'Dalarna', id: 20 },
{ label: 'Gävleborg', id: 21 },
{ label: 'Västernorrland', id: 22 },
{ label: 'Jämtland', id: 23 },
{ label: 'Västerbotten', id: 24 },
{ label: 'Norrbotten', id: 25 }
];
const optionsAntal = ['Antal nominerade', 'Andel nominerade', 'Antal valda', 'Andel valda', 'Antal ej valda'];
const optionsKön = ['män', 'kvinnor', 'totalt'];
return (
<div>
<MUI.Autocomplete
disablePortal
id="combo-box-demo"
options={provinceOptions}
sx={{ width: 300 }}
renderInput={(params) => <MUI.TextField {...params} label="Län" />}>
</MUI.Autocomplete>
<MUI.Typography variant='h6' fontWeight={'bold'}>
Tabellinnehål
</MUI.Typography>
<div className='multi_select'><MultiSelectText/></div>
<MUI.Typography variant='h6' fontWeight={'bold'}>
Kön
</MUI.Typography>
<div className='multi_select'><MultiSelectText2 /></div>
</div>
)
}
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
border-style: solid; border-style: solid;
padding: 5px; padding: 5px;
margin: 10px; margin: 10px;
width: 600px; width: 515px;
} }
.table_container{ .table_container{
display: flex; display: flex;
...@@ -19,8 +19,20 @@ ...@@ -19,8 +19,20 @@
margin: 10px; margin: 10px;
} }
.search_container{
padding: 5px;
border-style: solid;
margin: 10px;
}
.plot{ .plot{
width: 600px; width: 600px;
justify-content: center; justify-content: center;
}
.dashboard{
display: flex;
flex-direction: column;
margin: 10px;
padding: 10px;
} }
\ No newline at end of file
svg { svg {
background: white; background: white;
} }
path { path {
stroke: rgb(0, 0, 0); stroke: rgb(0, 0, 0);
stroke-width: 1px; stroke-width: 1px;
fill: white; fill: white;
} }
path:hover { path:hover {
stroke-width: 2px; stroke-width: 2px;
fill: rgb(214, 214, 214); fill: rgb(214, 214, 214);
} }
\ No newline at end of file \ No newline at end of file
.top-nav{ .top-nav{
position: absolute; display: flex;
top: 0px; flex-direction: row;
left: 150px; height: 70px;;
border: 2px;
background-color: rgba(180, 26, 26, 0.5); border-style: solid;
box-shadow: 0 0 10px rgba(0, 0, 0, .2);
width: 86.5vw; }
height: 10vh;; .h1{
margin-left: auto;
border: 2px solid rgba(255, 255, 255, .2); margin-right: auto;
box-shadow: 0 0 10px rgba(0, 0, 0, .2); margin-top: auto;
margin-bottom: auto;
color: white; }
border-radius: 10px; \ No newline at end of file
}
\ No newline at end of file
import '../../Css/Dashboard.css' import '../../Css/Dashboard.css'
import React, {useState} from 'react' import React, {useState} from 'react'
import TopNavBar from '../../Components/Navbar/Navbar';
import Map from './Map'; import Map from './Map';
import Visualiser from './Visualiser'; import Visualiser from './Visualiser';
import { Searchbar } from '../../Components/Search/Searchbar';
export const Dashboard = () => { export const Dashboard = () => {
const [data, setData] = useState({province: "", id: ""}); const [data, setData] = useState({province: "", id: ""});
...@@ -10,12 +11,21 @@ export const Dashboard = () => { ...@@ -10,12 +11,21 @@ export const Dashboard = () => {
setData(Region_data) setData(Region_data)
} }
return ( return (
<div className='container'> <div className='dashboard'>
<div className='map_container' id="d3_map"></div> <TopNavBar/>
<Map handlerFunction={handlerFunction}/> <div className='container'>
<div className='map_container' id="d3_map">
<Map handlerFunction={handlerFunction}/>
</div>
<div className='table_container'> <div className='search_container'>
<Visualiser Regiondata = {data}/> <Searchbar/>
</div>
<div className='table_container'>
<Visualiser Regiondata = {data}/>
</div>
</div> </div>
</div> </div>
) )
......
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom/client'; import ReactDOM from 'react-dom/client';
import { BrowserRouter } from "react-router-dom";
import './Css/index.css'; import './Css/index.css';
import Form from './Pages/SignupSigninForms/Form';
import { Dashboard } from './Pages/Dashboard/Dashboard'; import { Dashboard } from './Pages/Dashboard/Dashboard';
import TopNavBar from './Components/Navbar/Navbar';
import Map from './Pages/Dashboard/Map';
const root = ReactDOM.createRoot(document.getElementById('root')); const root = ReactDOM.createRoot(document.getElementById('root'));
root.render( root.render(
<React.StrictMode> <React.StrictMode>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment