First Commit!
This commit is contained in:
parent
4432a35fea
commit
32bc836787
25 changed files with 1229 additions and 214 deletions
38
src/App.css
38
src/App.css
|
@ -1,38 +0,0 @@
|
|||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
56
src/App.js
56
src/App.js
|
@ -1,26 +1,38 @@
|
|||
import React from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import styled, { createGlobalStyle } from 'styled-components';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.js</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
import SearchBar from './components/searchBar'
|
||||
import Greeter from './components/greeter'
|
||||
import AppList from './components/appList'
|
||||
import BookmarkList from './components/bookmarkList'
|
||||
import SettingsModal from './components/settingsModal'
|
||||
|
||||
import themeData from './components/data/themes.json';
|
||||
const selectedTheme = localStorage.getItem("theme") ? JSON.parse(localStorage.getItem("theme")) : themeData.themes[0];
|
||||
|
||||
const GlobalStyle = createGlobalStyle`
|
||||
body {
|
||||
background-color: ${selectedTheme.backgroundColor};
|
||||
}
|
||||
`;
|
||||
|
||||
const AppContainer = styled.div`
|
||||
max-width: 80%;
|
||||
margin: auto;
|
||||
padding: 10px;
|
||||
`;
|
||||
|
||||
const App = () => (
|
||||
<>
|
||||
<GlobalStyle />
|
||||
<AppContainer>
|
||||
<SearchBar />
|
||||
<SettingsModal />
|
||||
<Greeter />
|
||||
<AppList />
|
||||
<BookmarkList />
|
||||
</AppContainer>
|
||||
</>
|
||||
);
|
||||
|
||||
export default App;
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
const { getByText } = render(<App />);
|
||||
const linkElement = getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
93
src/components/appList.js
Normal file
93
src/components/appList.js
Normal file
|
@ -0,0 +1,93 @@
|
|||
import React from 'react';
|
||||
import MaterialIcon from 'material-icons-react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import appData from './data/apps.json';
|
||||
|
||||
import themeData from './data/themes.json'
|
||||
const selectedTheme = localStorage.getItem("theme") ? JSON.parse(localStorage.getItem("theme")) : themeData.themes[0];
|
||||
|
||||
const AppListContainer = styled.div`
|
||||
padding: 2rem 0 2rem 0;
|
||||
`;
|
||||
|
||||
const AppsContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@media (max-width: 600px) {
|
||||
flex-direction: column;
|
||||
}
|
||||
`;
|
||||
|
||||
const AppContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex: 1 0 21%;
|
||||
padding: 1rem 0 1rem 0;
|
||||
|
||||
@media (max-width: 750px) {
|
||||
flex: 1 0 42%;
|
||||
}
|
||||
`;
|
||||
|
||||
const IconContainer = styled.div`
|
||||
margin-right: 5px;
|
||||
`;
|
||||
|
||||
const AppDetails = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
`;
|
||||
|
||||
const ApplicationsText = styled.h3`
|
||||
font-family: Roboto, sans-serif;
|
||||
font-weight: 900;
|
||||
text-transform: uppercase;
|
||||
margin: 0px;
|
||||
font-size: 20px;
|
||||
color: ${selectedTheme.mainColor};
|
||||
`;
|
||||
|
||||
const Link = styled.a`
|
||||
font-family: Roboto, sans-serif;
|
||||
color: ${selectedTheme.mainColor};
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
margin: 0px;
|
||||
text-decoration: none;
|
||||
font-size: 15px;
|
||||
`;
|
||||
|
||||
const Description = styled.p`
|
||||
font-family: Roboto, sans-serif;
|
||||
text-transform: uppercase;
|
||||
margin: 0px;
|
||||
font-size: 10px;
|
||||
font-weight: 400;
|
||||
color: ${selectedTheme.accentColor};
|
||||
`;
|
||||
|
||||
const appList = () => (
|
||||
<AppListContainer>
|
||||
<ApplicationsText>Applications</ApplicationsText>
|
||||
<AppsContainer>
|
||||
{
|
||||
appData.apps.map((app) => (
|
||||
<AppContainer>
|
||||
<IconContainer>
|
||||
<MaterialIcon icon={app.icon} color={selectedTheme.mainColor}/>
|
||||
</IconContainer>
|
||||
<AppDetails>
|
||||
<Link href={app.URL}>{app.name}</Link>
|
||||
<Description>{app.displayURL}</Description>
|
||||
</AppDetails>
|
||||
</AppContainer>
|
||||
))
|
||||
}
|
||||
</AppsContainer>
|
||||
</AppListContainer>
|
||||
);
|
||||
|
||||
export default appList;
|
79
src/components/bookmarkList.js
Normal file
79
src/components/bookmarkList.js
Normal file
|
@ -0,0 +1,79 @@
|
|||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import bookmarkData from './data/bookmarks.json';
|
||||
|
||||
import themeData from './data/themes.json'
|
||||
const selectedTheme = localStorage.getItem("theme") ? JSON.parse(localStorage.getItem("theme")) : themeData.themes[0];
|
||||
|
||||
const BookmarksText = styled.h3`
|
||||
font-family: Roboto, sans-serif;
|
||||
text-transform: uppercase;
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
color: ${selectedTheme.mainColor};
|
||||
`;
|
||||
|
||||
const GroupText = styled.h4`
|
||||
font-family: Roboto, sans-serif;
|
||||
font-weight: 700;
|
||||
margin: 0;
|
||||
text-transform: uppercase;
|
||||
color: ${selectedTheme.mainColor};
|
||||
`;
|
||||
|
||||
const BookmarkListContainer = styled.div`
|
||||
padding: 2rem 0 2rem 0;
|
||||
`;
|
||||
|
||||
const BookmarksContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
|
||||
@media (max-width: 600px) {
|
||||
flex-direction: column;
|
||||
}
|
||||
`;
|
||||
|
||||
const BookmarkGroupContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 0 21%;
|
||||
padding-top: 2rem;
|
||||
font-size: 15px;
|
||||
`;
|
||||
|
||||
const Bookmark = styled.a`
|
||||
font-family: Roboto, sans-serif;
|
||||
font-weight: 400;
|
||||
text-decoration: none;
|
||||
color: ${selectedTheme.accentColor};
|
||||
padding: 10px 0 0 0;
|
||||
font-size: 14px;
|
||||
`;
|
||||
|
||||
const bookmarkList = () => (
|
||||
<BookmarkListContainer>
|
||||
<BookmarksText>Bookmarks</BookmarksText>
|
||||
<BookmarksContainer>
|
||||
|
||||
{
|
||||
bookmarkData.groups.map((group) => (
|
||||
<BookmarkGroupContainer>
|
||||
<GroupText>{group.name}</GroupText>
|
||||
{
|
||||
group.items.map((link) => (
|
||||
<Bookmark href={link.url}>{link.name}</Bookmark>
|
||||
))
|
||||
}
|
||||
</BookmarkGroupContainer>
|
||||
))
|
||||
}
|
||||
|
||||
</BookmarksContainer>
|
||||
</BookmarkListContainer>
|
||||
);
|
||||
|
||||
export default bookmarkList;
|
58
src/components/data/apps.json
Normal file
58
src/components/data/apps.json
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"apps": [
|
||||
{
|
||||
"name": "PiHole",
|
||||
"displayURL": "example.com",
|
||||
"URL": "https://example.com",
|
||||
"icon": "vpn_lock"
|
||||
},
|
||||
{
|
||||
"name": "Plex",
|
||||
"displayURL": "example.com",
|
||||
"URL": "https://example.com",
|
||||
"icon": "tv"
|
||||
},
|
||||
{
|
||||
"name": "NextCloud",
|
||||
"displayURL": "example.com",
|
||||
"URL": "https://example.com",
|
||||
"icon": "filter_drama"
|
||||
},
|
||||
{
|
||||
"name": "Ghost",
|
||||
"displayURL": "example.com",
|
||||
"URL": "https://example.com",
|
||||
"icon": "rss_feed"
|
||||
},
|
||||
{
|
||||
"name": "Minecraft",
|
||||
"displayURL": "example.com",
|
||||
"URL": "https://example.com",
|
||||
"icon": "games"
|
||||
},
|
||||
{
|
||||
"name": "pfSense",
|
||||
"displayURL": "example.com",
|
||||
"URL": "https://example.com",
|
||||
"icon": "security"
|
||||
},
|
||||
{
|
||||
"name": "ESXi",
|
||||
"displayURL": "example.com",
|
||||
"URL": "https://example.com",
|
||||
"icon": "dns"
|
||||
},
|
||||
{
|
||||
"name": "Tautulli",
|
||||
"displayURL": "example.com",
|
||||
"URL": "https://example.com",
|
||||
"icon": "bar_chart"
|
||||
},
|
||||
{
|
||||
"name": "Grafana",
|
||||
"displayURL": "example.com",
|
||||
"URL": "https://example.com",
|
||||
"icon": "show_chart"
|
||||
}
|
||||
]
|
||||
}
|
140
src/components/data/bookmarks.json
Normal file
140
src/components/data/bookmarks.json
Normal file
|
@ -0,0 +1,140 @@
|
|||
{
|
||||
"groups": [
|
||||
{
|
||||
"name": "Communicate",
|
||||
"items": [
|
||||
{
|
||||
"name": "Discord",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Gmail",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Slack",
|
||||
"url": "https://example.com"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Cloud",
|
||||
"items": [
|
||||
{
|
||||
"name": "Box",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Dropbox",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Drive",
|
||||
"url": "https://example.com"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Design",
|
||||
"items": [
|
||||
{
|
||||
"name": "Awwwards",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Dribbble",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Muz.li",
|
||||
"url": "https://example.com"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Dev",
|
||||
"items": [
|
||||
{
|
||||
"name": "Codepen",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Devdocs",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Devhints",
|
||||
"url": "https://example.com"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Lifestyle",
|
||||
"items": [
|
||||
{
|
||||
"name": "Design Milk",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Dwell",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Freshome",
|
||||
"url": "https://example.com"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Media",
|
||||
"items": [
|
||||
{
|
||||
"name": "Spotify",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Trakt",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "YouTube",
|
||||
"url": "https://example.com"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Reading",
|
||||
"items": [
|
||||
{
|
||||
"name": "Instapaper",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Medium",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "Reddit",
|
||||
"url": "https://example.com"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Tech",
|
||||
"items": [
|
||||
{
|
||||
"name": "TheNextWeb",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "The Verge",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
{
|
||||
"name": "MIT Technology Review",
|
||||
"url": "https://example.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
64
src/components/data/search.json
Normal file
64
src/components/data/search.json
Normal file
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"providers":[
|
||||
{
|
||||
"name":"Allmusic",
|
||||
"url":"https://www.allmusic.com/search/all/",
|
||||
"prefix":"/a"
|
||||
},
|
||||
{
|
||||
"name":"Discogs",
|
||||
"url":"https://www.discogs.com/search/?q=",
|
||||
"prefix":"/di"
|
||||
},
|
||||
{
|
||||
"name":"Duck Duck Go",
|
||||
"url":"https://duckduckgo.com/?q=",
|
||||
"prefix":"/d"
|
||||
},
|
||||
{
|
||||
"name":"iMDB",
|
||||
"url":"https://www.imdb.com/find?q=",
|
||||
"prefix":"/i"
|
||||
},
|
||||
{
|
||||
"name":"TheMovieDB",
|
||||
"url":"https://www.themoviedb.org/search?query=",
|
||||
"prefix":"/m"
|
||||
},
|
||||
{
|
||||
"name":"Reddit",
|
||||
"url":"https://www.reddit.com/search?q=",
|
||||
"prefix":"/r"
|
||||
},
|
||||
{
|
||||
"name":"Qwant",
|
||||
"url":"https://www.qwant.com/?q=",
|
||||
"prefix":"/q"
|
||||
},
|
||||
{
|
||||
"name":"Soundcloud",
|
||||
"url":"https://soundcloud.com/search?q=",
|
||||
"prefix":"/so"
|
||||
},
|
||||
{
|
||||
"name":"Spotify",
|
||||
"url":"https://open.spotify.com/search/results/",
|
||||
"prefix":"/s"
|
||||
},
|
||||
{
|
||||
"name":"TheTVDB",
|
||||
"url":"https://www.thetvdb.com/search?q=",
|
||||
"prefix":"/tv"
|
||||
},
|
||||
{
|
||||
"name":"Trakt",
|
||||
"url":"https://trakt.tv/search?query=",
|
||||
"prefix":"/t"
|
||||
},
|
||||
{
|
||||
"name": "YouTube",
|
||||
"url": "https://youtube.com/results?search_query=",
|
||||
"prefix":"/yt"
|
||||
}
|
||||
]
|
||||
}
|
25
src/components/data/themes.json
Normal file
25
src/components/data/themes.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"themes": [
|
||||
{
|
||||
"label": "Classic",
|
||||
"value": 0,
|
||||
"mainColor": "#000000",
|
||||
"accentColor": "#1e272e",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
{
|
||||
"label": "Dark",
|
||||
"value": 1,
|
||||
"mainColor": "#ffffff",
|
||||
"accentColor": "#999999",
|
||||
"backgroundColor": "#000000"
|
||||
},
|
||||
{
|
||||
"label": "Raw",
|
||||
"value": 2,
|
||||
"mainColor": "",
|
||||
"accentColor": "",
|
||||
"backgroundColor": "#ffffff"
|
||||
}
|
||||
]
|
||||
}
|
73
src/components/greeter.js
Normal file
73
src/components/greeter.js
Normal file
|
@ -0,0 +1,73 @@
|
|||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import themeData from './data/themes.json'
|
||||
const selectedTheme = localStorage.getItem("theme") ? JSON.parse(localStorage.getItem("theme")) : themeData.themes[0];
|
||||
|
||||
const GreeterContainer = styled.div`
|
||||
padding: 2rem 0 2rem 0;
|
||||
`;
|
||||
|
||||
const GreetText = styled.h1`
|
||||
font-family: Roboto, sans-serif;
|
||||
font-weight: 900;
|
||||
font-size: 45px;
|
||||
margin: 0.5rem 0 0.5rem 0;
|
||||
color: ${selectedTheme.mainColor};
|
||||
`;
|
||||
|
||||
const DateText = styled.h3`
|
||||
font-family: Roboto, sans-serif;
|
||||
font-weight: 400;
|
||||
font-size: 15px;
|
||||
text-transform: uppercase;
|
||||
margin: 0;
|
||||
color: ${selectedTheme.accentColor};
|
||||
`;
|
||||
|
||||
const getGreeting = () => {
|
||||
// Maybe add some expandability for different greetings?
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
const getExtension = (day) => {
|
||||
let extension = ""
|
||||
|
||||
if ((day > 4 && day <= 20) || (day > 20 && day % 10 >= 4)) {
|
||||
extension = "th"
|
||||
} else if (day % 10 === 1) {
|
||||
extension = "st"
|
||||
} else if (day % 10 === 2) {
|
||||
extension = "nd"
|
||||
} else if (day % 10 === 3) {
|
||||
extension = "rd"
|
||||
}
|
||||
|
||||
return extension
|
||||
}
|
||||
|
||||
const getDateString = () => {
|
||||
let currentDate = new Date();
|
||||
|
||||
const monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
|
||||
|
||||
const weekDayNames = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
|
||||
|
||||
return weekDayNames[currentDate.getUTCDay()] + ", " + monthNames[currentDate.getUTCMonth()] + " " + currentDate.getDate() + getExtension(currentDate.getDate()) + " " + currentDate.getFullYear();
|
||||
}
|
||||
|
||||
const greeter = () => {
|
||||
|
||||
let date = getDateString();
|
||||
let greeting = getGreeting();
|
||||
|
||||
return (
|
||||
<GreeterContainer>
|
||||
<DateText>{ date }</DateText>
|
||||
<GreetText>{ greeting }</GreetText>
|
||||
</GreeterContainer>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export default greeter;
|
69
src/components/searchBar.js
Normal file
69
src/components/searchBar.js
Normal file
|
@ -0,0 +1,69 @@
|
|||
import React, {useState} from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import searchData from './data/search.json';
|
||||
|
||||
import themeData from './data/themes.json';
|
||||
const selectedTheme = localStorage.getItem("theme") ? JSON.parse(localStorage.getItem("theme")) : themeData.themes[0];
|
||||
|
||||
const SearchInput = styled.input`
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
border-bottom: 1px solid ${selectedTheme.accentColor};
|
||||
background: none;
|
||||
border-radius: 0;
|
||||
color: ${selectedTheme.mainColor};
|
||||
`;
|
||||
|
||||
const handleQueryWithProvider = (query) => {
|
||||
|
||||
let queryArray = query.split(" ");
|
||||
|
||||
let prefix = queryArray[0];
|
||||
|
||||
queryArray.shift();
|
||||
|
||||
let searchQuery = queryArray.join(" ");
|
||||
|
||||
var foundProvider = false;
|
||||
searchData.providers.forEach((provider) => {
|
||||
if (provider.prefix === prefix) {
|
||||
foundProvider = true;
|
||||
window.location = provider.url + searchQuery
|
||||
}
|
||||
})
|
||||
|
||||
if (!foundProvider) {
|
||||
window.location = "https://google.com/search?q=" + query;
|
||||
}
|
||||
}
|
||||
|
||||
const SearchBar = () => {
|
||||
|
||||
let [input, setInput] = useState();
|
||||
|
||||
const handleSearchQuery = (e) => {
|
||||
|
||||
var query = input;
|
||||
|
||||
console.log(query)
|
||||
|
||||
if (query.split(" ")[0].includes("/")) {
|
||||
handleQueryWithProvider(query)
|
||||
} else {
|
||||
window.location = "https://google.com/search?q=" + query;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={(e) => handleSearchQuery(e)}>
|
||||
<SearchInput type="text" onChange={(e) => setInput(e.target.value)}></SearchInput>
|
||||
<button type="submit" hidden />
|
||||
</form>
|
||||
)
|
||||
}
|
||||
|
||||
export default SearchBar;
|
175
src/components/settingsModal.js
Normal file
175
src/components/settingsModal.js
Normal file
|
@ -0,0 +1,175 @@
|
|||
import React, { useState } from 'react';
|
||||
import MaterialIcon from 'material-icons-react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import Select from 'react-select';
|
||||
|
||||
import searchData from './data/search.json'
|
||||
import themeData from './data/themes.json'
|
||||
|
||||
import getTheme, { setTheme } from './themeManager'
|
||||
|
||||
const selectedTheme = getTheme();
|
||||
|
||||
const ModalButton = styled.button`
|
||||
float: right;
|
||||
|
||||
border: none;
|
||||
background: none;
|
||||
padding: 10px;
|
||||
`;
|
||||
|
||||
const ExitButton = styled.button`
|
||||
float: right;
|
||||
|
||||
border: none;
|
||||
background: none;
|
||||
`;
|
||||
|
||||
const Modal = styled.div`
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
padding: 1rem;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 10;
|
||||
border: 1px solid ${selectedTheme.mainColor};
|
||||
background-color: ${selectedTheme.backgroundColor};
|
||||
`;
|
||||
|
||||
const SelectContainer = styled.div`
|
||||
padding-bottom: 1rem;
|
||||
`;
|
||||
|
||||
const FormContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
`;
|
||||
|
||||
const ApplyButton = styled.button`
|
||||
font-family: Roboto, sans-serif;
|
||||
text-transform: uppercase;
|
||||
font-weight: 400;
|
||||
border: 1px solid ${selectedTheme.mainColor};
|
||||
color: ${selectedTheme.mainColor};
|
||||
background: none;
|
||||
margin-left: 1rem;
|
||||
`;
|
||||
|
||||
const Headline = styled.h3`
|
||||
font-family: Roboto, sans-serif;
|
||||
font-weight: 900;
|
||||
color: ${selectedTheme.mainColor};
|
||||
margin-top: 0;
|
||||
`;
|
||||
|
||||
const SelectorStyle = {
|
||||
control: (provided) => ({
|
||||
...provided,
|
||||
fontFamily: "Roboto, sans-serif",
|
||||
fontWeight: "500",
|
||||
color: selectedTheme.mainColor,
|
||||
textTransform: "uppercase",
|
||||
width: "200px",
|
||||
background: "none",
|
||||
borderRadius: "0px",
|
||||
border: "1px solid " + selectedTheme.mainColor,
|
||||
boxShadow: 0,
|
||||
'&:hover': {
|
||||
border: "1px solid " + selectedTheme.mainColor,
|
||||
}
|
||||
}),
|
||||
menu: (provided) => ({
|
||||
...provided,
|
||||
backgroundColor: selectedTheme.backgroundColor,
|
||||
border: "1px solid " + selectedTheme.mainColor,
|
||||
borderRadius: "0px",
|
||||
boxShadow: 0,
|
||||
}),
|
||||
option: (provided) => ({
|
||||
...provided,
|
||||
fontFamily: "Roboto, sans-serif",
|
||||
fontWeight: "500",
|
||||
color: selectedTheme.mainColor,
|
||||
textTransform: "uppercase",
|
||||
borderRadius: "0px",
|
||||
boxShadow: 0,
|
||||
backgroundColor: selectedTheme.backgroundColor,
|
||||
'&:hover': {
|
||||
backgroundColor: selectedTheme.mainColor,
|
||||
color: selectedTheme.backgroundColor,
|
||||
}
|
||||
}),
|
||||
singleValue: (provided) => {
|
||||
return {
|
||||
...provided,
|
||||
color: selectedTheme.mainColor,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Table = styled.table`
|
||||
font-family: Roboto, sans-serif;
|
||||
font-weight: 400;
|
||||
background: none;
|
||||
color: ${selectedTheme.mainColor};
|
||||
`;
|
||||
|
||||
const TableRow = styled.tr`
|
||||
border-bottom: 1px solid ${selectedTheme.mainColor};
|
||||
`;
|
||||
|
||||
const TableCell = styled.td`
|
||||
background: none;
|
||||
padding-top: 0.5rem;
|
||||
`;
|
||||
|
||||
const HeadCell = styled.th`
|
||||
font-weight: 700;
|
||||
background: none;
|
||||
`;
|
||||
|
||||
const SettingsModal = () => {
|
||||
|
||||
const [modalHidden, setModalHidden] = useState(true);
|
||||
const [newTheme, setNewTheme] = useState();
|
||||
|
||||
return (
|
||||
<>
|
||||
<ModalButton onClick={() => setModalHidden(!modalHidden)}>
|
||||
<MaterialIcon icon="settings" color={selectedTheme.mainColor} />
|
||||
</ModalButton>
|
||||
<Modal hidden={modalHidden}>
|
||||
<ExitButton onClick={() => setModalHidden(!modalHidden)}>
|
||||
<MaterialIcon icon="close" color={selectedTheme.mainColor} />
|
||||
</ExitButton>
|
||||
<SelectContainer>
|
||||
<Headline>Theme:</Headline>
|
||||
<FormContainer>
|
||||
<Select options={themeData.themes} defaultValue={selectedTheme} onChange={(e) => {setNewTheme(e)}} styles={SelectorStyle} />
|
||||
<ApplyButton onClick={() => setTheme(JSON.stringify(newTheme))}>Apply</ApplyButton>
|
||||
</FormContainer>
|
||||
</SelectContainer>
|
||||
<Table>
|
||||
<TableRow>
|
||||
<HeadCell>Search Provider</HeadCell>
|
||||
<HeadCell>Prefix</HeadCell>
|
||||
</TableRow>
|
||||
{
|
||||
searchData.providers.map((provider) => (
|
||||
<TableRow>
|
||||
<TableCell>{provider.name}</TableCell>
|
||||
<TableCell>{provider.prefix}</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
}
|
||||
</Table>
|
||||
</Modal>
|
||||
</>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
export default SettingsModal;
|
25
src/components/themeManager.js
Normal file
25
src/components/themeManager.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import themeData from './data/themes.json';
|
||||
|
||||
const setTheme = (theme) => {
|
||||
localStorage.setItem("theme", theme);
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
const resetTheme = () => {
|
||||
localStorage.removeItem("theme");
|
||||
}
|
||||
|
||||
const getTheme = () => {
|
||||
|
||||
let selectedTheme = themeData.themes[0];
|
||||
|
||||
if (localStorage.getItem("theme") && localStorage.getItem("theme") !== undefined) {
|
||||
selectedTheme = JSON.parse(localStorage.getItem("theme"));
|
||||
}
|
||||
|
||||
return selectedTheme;
|
||||
}
|
||||
|
||||
export { setTheme, resetTheme }
|
||||
|
||||
export default getTheme;
|
|
@ -1,13 +0,0 @@
|
|||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
|
||||
<g fill="#61DAFB">
|
||||
<path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
|
||||
<circle cx="420.9" cy="296.5" r="45.7"/>
|
||||
<path d="M520.5 78.1z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.6 KiB |
Loading…
Add table
Add a link
Reference in a new issue