Skip to content

Commit

Permalink
Theme switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Mar 28, 2017
1 parent 3d137f7 commit 904d8fa
Show file tree
Hide file tree
Showing 79 changed files with 57 additions and 48 deletions.
12 changes: 1 addition & 11 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,13 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="stylesheet" href="%PUBLIC_URL%/resources/themes/omega/theme.css">
<link id="theme-link" rel="stylesheet" href="%PUBLIC_URL%/resources/themes/omega/theme.css">
<link rel="stylesheet" href="%PUBLIC_URL%/resources/primeng.min.css">
<script src="%PUBLIC_URL%/showcase/resources/script/prism.js" data-manual></script>

<title>PrimeReact</title>
</head>
<body>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body>
</html>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/showcase/resources/demo/images/themes/aristo.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
20 changes: 12 additions & 8 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ body {
left: 0;
top: 0;
background-color: #f6f6f6;
overflow: hidden;
overflow: auto;
width: 300px;
box-sizing: border-box;
-moz-box-shadow: 1px 0 10px rgba(0, 0, 0, 0.2);
Expand Down Expand Up @@ -339,8 +339,12 @@ body {
float: right;
}

#themeswitcher:hover > div {
display: block;
}

/** ThemeSwitcher **/
#GlobalThemeSwitcher {
#themeswitcher > div {
display: none;
text-align: left;
width: 200px;
Expand All @@ -358,18 +362,18 @@ body {
box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.2);
margin-left: -60px;
}
#GlobalThemeSwitcher a {
#themeswitcher > div a {
display: block;
padding: 10px;
border-bottom: solid 1px #dde3e7;
text-align: left;
color: #87939B;
overflow: hidden;
}
#GlobalThemeSwitcher a:hover {
#themeswitcher > div a:hover {
color: #fdd106;
}
#GlobalThemeSwitcher a span.ui-theme {
#themeswitcher > div a span.ui-theme {
width: 30px;
height: 27px;
float: left;
Expand All @@ -378,18 +382,18 @@ body {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
#GlobalThemeSwitcher a img {
#themeswitcher > div a img {
float: left;
width: 30px;
height: 27px;
}
#GlobalThemeSwitcher a span.ui-text {
#themeswitcher > div a span.ui-text {
display: inline-block;
margin-top: 7px;
margin-left: 10px;
font-size: 14px;
}
#GlobalThemeSwitcher > span {
#themeswitcher > div > span {
font-size: 18px;
display: inline-block;
margin: 20px 0 0 9px;
Expand Down
70 changes: 44 additions & 26 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import './App.css';

class Home extends Component {

render() {
return (
<div className="homepage">
Expand Down Expand Up @@ -196,11 +197,11 @@
<Link to="/fileupload">&#9679; Upload</Link>
</div>

<a href="#" onClick={(event) => this.openMenu(event,6)} className={classNames({'active-menuitem': this.state.activeMenu === 6})}>
<a href="#" onClick={(event) => this.openMenu(event,6)} className={classNames({'active-menuitem': this.state.activeMenu === 6})} style={{display:'none'}}>
<img alt="button" src="showcase/resources/images/mono/menu.svg"></img>
<span>Menu</span>
</a>
<div className={classNames({'submenu-hidden': this.state.activeMenu !== 6, 'submenu-visible': this.state.activeMenu === 6})}>
<div className={classNames({'submenu-hidden': this.state.activeMenu !== 6, 'submenu-visible': this.state.activeMenu === 6})} style={{display:'none'}}>

</div>

Expand All @@ -227,19 +228,19 @@
<Link to="/growl">&#9679; Growl</Link>
</div>

<a href="#" onClick={(event) => this.openMenu(event,9)} className={classNames({'active-menuitem': this.state.activeMenu === 9})}>
<a href="#" onClick={(event) => this.openMenu(event,9)} className={classNames({'active-menuitem': this.state.activeMenu === 9})} style={{display:'none'}}>
<img alt="button" src="showcase/resources/images/mono/multimedia.svg"></img>
<span>Multimedia</span>
</a>
<div className={classNames({'submenu-hidden': this.state.activeMenu !== 9, 'submenu-visible': this.state.activeMenu === 9})}>
<div className={classNames({'submenu-hidden': this.state.activeMenu !== 9, 'submenu-visible': this.state.activeMenu === 9})} style={{display:'none'}}>

</div>

<a href="#" onClick={(event) => this.openMenu(event,10)} className={classNames({'active-menuitem': this.state.activeMenu === 10})}>
<a href="#" onClick={(event) => this.openMenu(event,10)} className={classNames({'active-menuitem': this.state.activeMenu === 10})} style={{display:'none'}}>
<img alt="button" src="showcase/resources/images/mono/dragdrop.svg"></img>
<span>DragDrop</span>
</a>
<div className={classNames({'submenu-hidden': this.state.activeMenu !== 10, 'submenu-visible': this.state.activeMenu === 10})}>
<div className={classNames({'submenu-hidden': this.state.activeMenu !== 10, 'submenu-visible': this.state.activeMenu === 10})} style={{display:'none'}}>

</div>

Expand All @@ -257,6 +258,22 @@
}

class App extends Component {

constructor() {
super();
this.theme = 'omega';
this.changeTheme = this.changeTheme.bind(this);
}

changeTheme(event) {
var theme = event.currentTarget.dataset.theme;
var themeElement = document.getElementById('theme-link');
var oldThemeURL = themeElement.getAttribute('href');
var newThemeURL = oldThemeURL.replace(this.theme, theme);
this.theme = theme;
themeElement.setAttribute('href', newThemeURL);
event.preventDefault();
}

render() {
return (
Expand All @@ -280,30 +297,31 @@
<img alt="logo" src="showcase/resources/images/menuicon.svg"/>
</a>

<a href="http://forum.primefaces.org/viewforum.php?f=35" className="topbar-link">
<a href="http://forum.primefaces.org/viewforum.php?f=57" className="topbar-link">
<img alt="mockosx" src="showcase/resources/images/forum.png" />
</a>

<span className="topbar-link" id="themeSwitcher">
<span id="themeswitcher" className="topbar-link">
<img alt="themeswitcher" src="showcase/resources/images/themes.png" />
<div id="GlobalThemeSwitcher">
<span>Free Themes</span>
<a href="#" data-theme="omega"><span className="ui-theme ui-theme-omega"></span><span className="ui-text">Omega</span></a>
<a href="#" data-theme="bootstrap"><span className="ui-theme ui-theme-bootstrap"></span><span className="ui-text">Bootstrap</span></a>
<a href="#" data-theme="aristo"><span className="ui-theme ui-theme-aristo"></span><span className="ui-text">Aristo</span></a>
<a href="#" data-theme="cupertino"><span className="ui-theme ui-theme-cupertino"></span><span className="ui-text">Cupertino</span></a>
<a href="#" data-theme="cruze"><span className="ui-theme ui-theme-cruze"></span><span className="ui-text">Cruze</span></a>
<a href="#" data-theme="darkness"><span className="ui-theme ui-theme-ui-darkness"></span><span className="ui-text">Darkness</span></a>
<a href="#" data-theme="delta"><span className="ui-theme ui-theme-delta"></span><span className="ui-text">Delta</span></a>
<a href="#" data-theme="flick"><span className="ui-theme ui-theme-flick"></span><span className="ui-text">Flick</span></a>
<a href="#" data-theme="home"><span className="ui-theme ui-theme-home"></span><span className="ui-text">Home</span></a>
<a href="#" data-theme="lightness"><span className="ui-theme ui-theme-ui-lightness"></span><span className="ui-text">Lightness</span></a>
<a href="#" data-theme="pepper-grinder"><span className="ui-theme ui-theme-pepper-grinder"></span><span className="ui-text">Pepper-Grinder</span></a>
<a href="#" data-theme="redmond"><span className="ui-theme ui-theme-redmond"></span><span className="ui-text">Redmond</span></a>
<a href="#" data-theme="rocket"><span className="ui-theme ui-theme-rocket"></span><span className="ui-text">Rocket</span></a>
<a href="#" data-theme="south-street"><span className="ui-theme ui-theme-south-street"></span><span className="ui-text">South-Street</span></a>
<a href="#" data-theme="start"><span className="ui-theme ui-theme-start"></span><span className="ui-text">Start</span></a>
<a href="#" data-theme="trontastic"><span className="ui-theme ui-theme-trontastic"></span><span className="ui-text">Trontastic</span></a>
<div>
<span>Themes</span>
<a href="#" data-theme="omega" onClick={this.changeTheme}><span className="ui-text">Omega</span></a>
<a href="#" data-theme="bootstrap" onClick={this.changeTheme}><span className="ui-text">Bootstrap</span></a>
<a href="#" data-theme="cruze" onClick={this.changeTheme}><span className="ui-text">Cruze</span></a>
<a href="#" data-theme="cupertino" onClick={this.changeTheme}><span className="ui-text">Cupertino</span></a>
<a href="#" data-theme="darkness" onClick={this.changeTheme}><span className="ui-text">Darkness</span></a>
<a href="#" data-theme="flick" onClick={this.changeTheme}><span className="ui-text">Flick</span></a>
<a href="#" data-theme="home" onClick={this.changeTheme}><span className="ui-text">Home</span></a>
<a href="#" data-theme="kasper" onClick={this.changeTheme}><span className="ui-text">Kasper</span></a>
<a href="#" data-theme="lightness" onClick={this.changeTheme}><span className="ui-text">Lightness</span></a>
<a href="#" data-theme="ludvig" onClick={this.changeTheme}><span className="ui-text">Ludvig</span></a>
<a href="#" data-theme="pepper-grinder" onClick={this.changeTheme}><span className="ui-text">Pepper-Grinder</span></a>
<a href="#" data-theme="redmond" onClick={this.changeTheme}><span className="ui-text">Redmond</span></a>
<a href="#" data-theme="rocket" onClick={this.changeTheme}><span className="ui-text">Rocket</span></a>
<a href="#" data-theme="south-street" onClick={this.changeTheme}><span className="ui-text">South-Street</span></a>
<a href="#" data-theme="start" onClick={this.changeTheme}><span className="ui-text">Start</span></a>
<a href="#" data-theme="trontastic" onClick={this.changeTheme}><span className="ui-text">Trontastic</span></a>
<a href="#" data-theme="voclain" onClick={this.changeTheme}><span className="ui-text">Voclain</span></a>
</div>
</span>

Expand Down
3 changes: 0 additions & 3 deletions src/showcase/setup/SetupPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { Component } from 'react';
import {Link} from 'react-router';
import {CodeHighlight} from '../../components/codehighlight/CodeHighlight';

export class SetupPage extends Component {
Expand Down Expand Up @@ -90,8 +89,6 @@ import 'font-awesome/css/font-awesome.css';

<h3>Quickstart</h3>
<p>An example application based on create-react-app is available at <a href="https://github.com/primefaces/primereact-quickstart">github</a>.</p>


</div>
</div>
);
Expand Down

0 comments on commit 904d8fa

Please sign in to comment.