Skip to content

Commit c09ecb1

Browse files
GarrettHutsoniancdavisYoheze
committed
finishing touches to make the context text visible
Co-authored-by: Ian Davis <[email protected]> Co-authored-by: Yohan Jeon <[email protected]>
1 parent 6ab2949 commit c09ecb1

File tree

5 files changed

+54
-23
lines changed

5 files changed

+54
-23
lines changed

app/src/components/ContextAPIManager/AssignTab/components/ComponentDropDrown.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import React, { Fragment, useState, useEffect, useContext } from 'react';
22
import TextField from '@mui/material/TextField';
33
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
44
import Box from '@mui/material/Box';
5-
import StateContext from '../../../../context/context';
5+
66
import { useSelector } from 'react-redux';
7+
import { Store } from 'redux';
78

89
const filter = createFilterOptions();
910

@@ -15,8 +16,11 @@ const ComponentDropDown = ({
1516
}) => {
1617
const { allContext } = contextStore;
1718
// const [componentList] = useContext(StateContext);
18-
const state = useSelector(store => store.appState)
19-
19+
const {state, isDarkMode} = useSelector(store =>({
20+
state: store.appState,
21+
isDarkMode: store.darkMode.isDarkMode
22+
} ))
23+
const color = isDarkMode ? "white":"black"
2024
const onChange = (event, newValue) => {
2125
if (typeof newValue === 'string') {
2226
setComponentInput({
@@ -66,11 +70,11 @@ const ComponentDropDown = ({
6670
return option.name;
6771
};
6872

69-
const renderOption = (props, option) => <li {...props}>{option.name}</li>;
73+
const renderOption = (props, option) => <li style={{ color: "black", border: "1px solid black" }} {...props}>{option.name}</li>;
7074

7175
return (
7276
<Fragment>
73-
<Box sx={{ display: 'flex', gap: 2, mb: 4 }}>
77+
<Box sx={{ display: 'flex', gap: 2, mb: 4}}>
7478
<Autocomplete
7579
id="autoCompleteContextField"
7680
value={componentInput}
@@ -82,10 +86,13 @@ const ComponentDropDown = ({
8286
options={state.components || []}
8387
getOptionLabel={getOptionLabel}
8488
renderOption={renderOption}
85-
sx={{ width: 425 }}
89+
sx={{ width: 425, border: "1px solid black" }}
8690
freeSolo
8791
renderInput={params => (
88-
<TextField {...params} label="Select Component" helperText='Select a component for your selected context to consume' />
92+
<TextField {...params} InputProps={{
93+
...params.InputProps,
94+
style: { color: color },
95+
}} label="Select Component" helperText='Select a component for your selected context to consume' />
8996
)}
9097
/>
9198
</Box>

app/src/components/ContextAPIManager/AssignTab/components/ContextDropDown.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
44
import Button from '@mui/material/Button';
55
import Box from '@mui/material/Box';
66
import { Typography } from '@mui/material';
7+
import { useSelector } from 'react-redux';
78

89
const filter = createFilterOptions();
910

@@ -15,6 +16,8 @@ const ContextDropDown = ({
1516
}) => {
1617
const { allContext } = contextStore;
1718

19+
const isDarkMode = useSelector(store => store.darkMode.isDarkMode)
20+
const color = isDarkMode ? "white":"black"
1821
const onChange = (event, newValue) => {
1922
if (typeof newValue === 'string') {
2023
setContextInput({
@@ -64,11 +67,11 @@ const ContextDropDown = ({
6467
return option.name;
6568
};
6669

67-
const renderOption = (props, option) => <li {...props}>{option.name}</li>;
70+
const renderOption = (props, option) => <li style={{ color:"black", border: "1px solid black" }} {...props}>{option.name}</li>;
6871

6972
return (
7073
<Fragment>
71-
<Box sx={{ display: 'flex', gap: 2, mb: 4 }}>
74+
<Box sx={{ display: 'flex', gap: 2, mb: 4, border:"1px black solid" }}>
7275
<Autocomplete
7376
id="autoCompleteContextField"
7477
value={contextInput}
@@ -83,7 +86,12 @@ const ContextDropDown = ({
8386
sx={{ width: 425 }}
8487
freeSolo
8588
renderInput={params => (
86-
<TextField {...params} label="Select Context" helperText='Select a context you would like to assign'/>
89+
<TextField {...params}
90+
InputProps={{
91+
...params.InputProps,
92+
style: { color },
93+
}}
94+
label="Select Context" helperText='Select a context you would like to assign'/>
8795
)}
8896
/>
8997
</Box>

app/src/components/ContextAPIManager/ContextManager.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,18 @@ const ContextManager = (props): JSX.Element => {
3434
};
3535

3636
const background_Color = isDarkMode ? '#21262b' : 'white'
37+
const color = isDarkMode ? 'white' : 'black'
3738

3839
return (
3940
<React.Fragment>
4041
<div className={classes.contextContainer} style={style.style}>
4142
<Box sx={{ width: '100%', typography: 'body1' }}>
42-
<TabContext value={value}>
43+
<TabContext value={value} sx={{color:color}}>
4344
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
44-
<TabList onChange={handleChange} centered={true}>
45-
<Tab label="Create/Edit" value="1" />
46-
<Tab label="Assign" value="2" />
47-
<Tab label="Display" value="3" />
45+
<TabList onChange={handleChange} centered={true} sx={{color:color}}>
46+
<Tab style={ { color: color }}label="Create/Edit" value="1" />
47+
<Tab style={{ color: color }} label="Assign" value="2" />
48+
<Tab style={{ color: color }} label="Display" value="3" />
4849
</TabList>
4950
</Box>
5051
<TabPanel value="1">

app/src/components/ContextAPIManager/CreateTab/components/AddContextForm.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ const AddContextForm = ({
1919
const { allContext } = contextStore;
2020
const [btnDisabled, setBtnDisabled] = useState(false);
2121
// const [state, dispatch] = useContext(StateContext);
22-
const state = useSelector(store => store.appState)
22+
const { state, isDarkMode } = useSelector(store => ({
23+
isDarkMode: store.darkMode.isDarkMode,
24+
state: store.appState
25+
}))
26+
const color = isDarkMode ? 'white' : 'black'
2327

2428
const handleClick = () => {
2529
if (contextInput === '' || contextInput === null) return;
@@ -75,11 +79,11 @@ const AddContextForm = ({
7579
return option.name;
7680
};
7781

78-
const renderOption = (props, option) => <li style={{color:'black'}} {...props}>{option.name}</li>;
82+
const renderOption = (props, option) => <li style={{ color: 'black' }} {...props}>{option.name}</li>;
7983

8084
return (
8185
<Fragment>
82-
<Typography style={{ color: 'black' }} variant="h6" gutterBottom={true}>
86+
<Typography style={{ color: color }} variant="h6" gutterBottom={true}>
8387
Context Input
8488
</Typography>
8589
<Box sx={{ display: 'flex', gap: 2, mb: 4 }}>
@@ -94,10 +98,15 @@ const AddContextForm = ({
9498
options={allContext || []}
9599
getOptionLabel={getOptionLabel}
96100
renderOption={renderOption}
97-
sx={{ width: 425, border:'1px solid black' }}
101+
sx={{ width: 425, border: '1px solid black' }}
98102
freeSolo
99103
renderInput={params => (
100-
<TextField {...params} label="Create/Select Context" />
104+
<TextField {...params} InputProps={{
105+
...params.InputProps,
106+
style: { color: color },
107+
}}
108+
variant='filled'
109+
label="Create/Select Context" />
101110
)}
102111
/>
103112
<Button

app/src/components/ContextAPIManager/CreateTab/components/AddDataForm.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ import TextField from '@mui/material/TextField';
33
import Button from '@mui/material/Button';
44
import Box from '@mui/material/Box';
55
import { Typography } from '@mui/material';
6+
import {useSelector} from 'react-redux'
67

78
const AddDataForm = ({ handleClickInputData, contextInput }) => {
89
//const [contextInput, setContextInput] = React.useState(null);
910
const defaultInputData = {inputKey: '', inputValue: ''};
1011
const [dataContext, setDataContext] = React.useState(defaultInputData);
11-
12+
const {isDarkMode} = useSelector(store=> store.darkMode.isDarkMode)
1213
const saveData = () => {
1314
setDataContext(defaultInputData);
1415
handleClickInputData(contextInput, dataContext)
1516
}
17+
const color = isDarkMode ? 'white' : 'black';
1618

1719
const handleChange = e => {
1820
setDataContext(prevDataContext => {
@@ -25,17 +27,19 @@ const AddDataForm = ({ handleClickInputData, contextInput }) => {
2527

2628
return (
2729
<Fragment>
28-
<Typography style={{ color: 'black' }} variant="h6" gutterBottom={true}>
30+
<Typography style={{ color: color }} variant="h6" gutterBottom={true}>
2931
Add context data
3032
</Typography>
31-
<Box sx={{ display: 'flex', gap: 2 }}>
33+
<Box sx={{ display: 'flex', gap: 2, color:'black' }}>
3234
<TextField
3335
id="outlined-basic"
3436
label="Key"
3537
variant="outlined"
3638
value={dataContext.inputKey}
3739
name="inputKey"
3840
onChange={e => handleChange(e)}
41+
InputProps={{style: { color: color }}}
42+
style={{border:'1px solid black'}}
3943
/>
4044
<TextField
4145
id="outlined-basic"
@@ -44,6 +48,8 @@ const AddDataForm = ({ handleClickInputData, contextInput }) => {
4448
value={dataContext.inputValue}
4549
name="inputValue"
4650
onChange={e => handleChange(e)}
51+
style={{border:'1px solid black'}}
52+
InputProps={{ style: { color: color }}}
4753
/>
4854
<Button
4955
variant="contained"

0 commit comments

Comments
 (0)