Skip to content

Commit

Permalink
Minor changes.
Browse files Browse the repository at this point in the history
Select component now shows the correct color.
  • Loading branch information
lupusA committed Apr 10, 2023
1 parent 7f43436 commit f89430f
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 23 deletions.
45 changes: 30 additions & 15 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ html.loading {

body {
line-height: 1;
color: var(--text-color-body);
background-color: var(--background-color);
}

.options-select {
overflow: ellipsis
.container-fluid {
color: var(--text-color-body);
}

.navbar-light .navbar-nav .nav-link {
color: var(--text-color-nav);
.select {
color: var(--text-color-selector);
}

.navbar-light .navbar-nav .nav-link.active, .navbar-light .navbar-nav .show>.nav-link {
color: var(--text-color-nav);
.select select:hover {
color: var(--text-color-selector);
}

.options-select {
overflow: ellipsis
}

.btn {
Expand Down Expand Up @@ -55,14 +58,6 @@ body {
border-color: var(--color-danger);
}

.select {
color: black;
}

.table {
color: var(--text-color-body);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .open>.dropdown-toggle.btn-primary {
background-color: var(--color-primary);
border-color: var(--color-primary);
Expand Down Expand Up @@ -105,6 +100,26 @@ body {
filter: brightness(80%);
}

.table {
color: var(--text-color-body);
}

.table table-sm table-striped table-bordered table-hover {
color: var(--text-color-body);
}

.table-striped>tbody>tr:nth-of-type(odd)>* {
color: var(--text-color-body);
}

.navbar-light .navbar-nav .nav-link {
color: var(--text-color-nav);
}

.navbar-light .navbar-nav .nav-link.active, .navbar-light .navbar-nav .show>.nav-link {
color: var(--text-color-nav);
}

.popover {
max-width: 1000px;
}
Expand Down
3 changes: 1 addition & 2 deletions src/PoliciesTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export class PoliciesTable extends Component {
return <p>Loading ...</p>;
}


let uniqueOwners = sources.reduce((a, d) => {
const owner = ownerName(d.source);

Expand Down Expand Up @@ -245,7 +244,7 @@ export class PoliciesTable extends Component {
id: 'edit',
Header: '',
width: 50,
Cell: x => <Link to={policyEditorURL(x.row.original.target)}><Button size="sm">Edit</Button></Link>,
Cell: x => <Button data-testid="edit-policy" as={Link} to={policyEditorURL(x.row.original.target)} variant="primary" size="sm">Edit</Button>
}]

return <>
Expand Down
8 changes: 6 additions & 2 deletions src/Theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
--color-submit: #00B4D8;

--text-color: #ffffff;
--text-color-selector: #000000;
--text-color-body: #000000;
--text-color-nav: #000000;

Expand All @@ -16,14 +17,15 @@
}

.dark-theme {
--background-color: #000000;
--background-color: #343c43;
--color-primary: #1162b1;
--color-secondary: #0d9aab;
--color-warning: #b30996;
--color-success: #030303;
--color-success: #00B4D8;
--color-submit: #00B4D8;

--text-color: #ffffff;
--text-color-selector: #000000;
--text-color-body: #ffffff;
--text-color-nav: #ffffff;

Expand All @@ -40,6 +42,7 @@
--color-submit: #00B4D8;

--text-color: #000000;
--text-color-selector: #000000;
--text-color-body: #000000;
--text-color-nav: #d7a5e9;

Expand All @@ -56,6 +59,7 @@
--color-submit: #00B4D8;

--text-color: #ffffff;
--text-color-selector: #000000;
--text-color-body: #03045E;
--text-color-nav: #03045E;

Expand Down
16 changes: 12 additions & 4 deletions src/ThemeSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import Select from 'react-select'
import Select, { components } from 'react-select'
import { useContext } from 'react';
import { Theme, UIPreferencesContext } from './contexts/UIPreferencesContext';

export function ThemeSelector() {
const { theme, setTheme } = useContext(UIPreferencesContext);

updateTheme(theme)

const themes = [
{ value: 'light-theme', label: 'light' },
Expand All @@ -14,14 +12,24 @@ export function ThemeSelector() {
{ value: 'ocean-theme', label: 'ocean' }
]

updateTheme(theme)

const handleTheme = (event: any) => {
var selectedTheme = event.value;
// keep html class in sync with button state.
updateTheme(selectedTheme)
setTheme(selectedTheme)
};

return <Select defaultValue={themes[0]} options={themes} onChange={handleTheme} />
return <Select options={themes} classNamePrefix="select" onChange={handleTheme}
components={{
SingleValue: ({ children, ...props }) => {
return (
<components.SingleValue {...props}>
{"Theme: " + children}
</components.SingleValue>
);
}}}/>
}

function updateTheme(theme: Theme) {
Expand Down

0 comments on commit f89430f

Please sign in to comment.