Skip to content

Commit

Permalink
✏️ Add link color to config (#604)
Browse files Browse the repository at this point in the history
* feat: move link color to config

* ✏️ Set default theme to use default color
  • Loading branch information
viettrung9012 authored and timmo001 committed Oct 6, 2019
1 parent 4d45324 commit 39b420b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
3 changes: 2 additions & 1 deletion api/config/config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"primary": "pink",
"secondary": "pink",
"background_default": "#303030",
"background_paper": "#383c45"
"background_paper": "#383c45",
"link_color": "#00ccff"
},
"header": {
"time_show": true,
Expand Down
12 changes: 11 additions & 1 deletion src/Components/Configuration/Config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type ThemeProps = {
background_default: string;
background_paper: string;
text_primary: string;
link_color: string;
};

export type HeaderProps = {
Expand Down Expand Up @@ -134,7 +135,8 @@ export const defaultTheme: ThemeProps = {
secondary: 'pink',
background_default: '#303030',
background_paper: '#383c45',
text_primary: '#ffffff'
text_primary: '#ffffff',
link_color: '#00ccff'
};

export const defaultPalette: PaletteOptions = {
Expand Down Expand Up @@ -340,6 +342,14 @@ export const items = [
icon: 'mdi-text',
type: 'color',
default: '#ffffff'
},
{
name: 'link_color',
title: 'Link',
description: '[Link](https://timmo.dev/home-panel/configui/) color.',
icon: 'mdi-link',
type: 'color',
default: '#00ccff'
}
]
},
Expand Down
7 changes: 6 additions & 1 deletion src/Components/Onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import socketio from '@feathersjs/socketio-client';
import { createMuiTheme, responsiveFontSizes } from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/styles';

import { ThemeProps, defaultPalette } from './Configuration/Config';
import { ThemeProps, defaultPalette, defaultTheme } from './Configuration/Config';
import clone from './Utils/clone';
import Loading from './Utils/Loading';
import Login from './Login';
Expand Down Expand Up @@ -141,8 +141,13 @@ function Onboarding(props: OnboardingProps) {
if (!loginAttempted)
return <Loading text="Attempting Login. Please Wait.." />;

const cssOverrides = `
a {color: ${(config && config.theme && config.theme.link_color) || defaultTheme.link_color};}
`;

return (
<ThemeProvider theme={theme}>
<style>{cssOverrides}</style>
{loginCredentials ? (
<Main
{...props}
Expand Down
14 changes: 2 additions & 12 deletions src/Style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,12 @@ code {
}

a {
transition: color 0.4s;
color: #e0e0e0;
text-decoration: none;
}

a:visited {
color: #bdbdbd;
}

a:hover {
color: #bdbdbd;
}

a:active {
transition: color 0.3s;
color: #bdbdbd;
transition: 0.2s;
font-weight: bolder;
}

::-webkit-scrollbar {
Expand Down

0 comments on commit 39b420b

Please sign in to comment.