Added w95 styles, building out about page work section
This commit is contained in:
65
public/window/AddressBar.jsx
Normal file
65
public/window/AddressBar.jsx
Normal file
@ -0,0 +1,65 @@
|
||||
// Copyright (c) 2018 Dominic Masters
|
||||
//
|
||||
// MIT License
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import Frame from './Frame';
|
||||
import Language from './../language/Language';
|
||||
|
||||
class AddressBar extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
onChange() {
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
let clazz = "o-window__address-bar";
|
||||
|
||||
return (
|
||||
<div className={clazz}>
|
||||
<span className="o-window__address-bar-title">
|
||||
{ Language.get("window.address") }
|
||||
</span>
|
||||
<Frame className="o-window__address-bar-frame">
|
||||
<input
|
||||
type="text"
|
||||
value={this.props.href}
|
||||
className="o-window__input o-window__address-bar-input"
|
||||
onChange={ this.onChange.bind(this) }
|
||||
/>
|
||||
</Frame>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
code: state.language.code
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(AddressBar);
|
53
public/window/ContextMenu.jsx
Normal file
53
public/window/ContextMenu.jsx
Normal file
@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2018 Dominic Masters
|
||||
//
|
||||
// MIT License
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import React from 'react';
|
||||
|
||||
class ContextMenu extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="o-window__context-menu" ref="menu">
|
||||
{ this.props.children }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default ContextMenu;
|
||||
|
||||
const ContextMenuOption = (props) => {
|
||||
return (
|
||||
<div className="o-window__context-menu-option">
|
||||
<div className="o-window__context-menu-option-title">
|
||||
{ props.title }
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export {
|
||||
ContextMenuOption
|
||||
}
|
37
public/window/Frame.jsx
Normal file
37
public/window/Frame.jsx
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2018 Dominic Masters
|
||||
//
|
||||
// MIT License
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import React from 'react';
|
||||
|
||||
export default (props) => {
|
||||
let clazz = "o-window__frame";
|
||||
if(props.className) {
|
||||
clazz += " " + props.className;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={clazz}>
|
||||
{ props.children }
|
||||
</div>
|
||||
);
|
||||
}
|
143
public/window/MenuBar.jsx
Normal file
143
public/window/MenuBar.jsx
Normal file
@ -0,0 +1,143 @@
|
||||
// Copyright (c) 2018 Dominic Masters
|
||||
//
|
||||
// MIT License
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import React from 'react';
|
||||
import ContextMenu from './ContextMenu';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
export default (props) => {
|
||||
return (
|
||||
<div className="o-window__menu-bar">
|
||||
{ props.children }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
class MenuOption extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
//Bound Methods
|
||||
this.onClickBound = this.onClick.bind(this);
|
||||
this.onMouseLeaveBound = this.onMouseLeave.bind(this);
|
||||
|
||||
this.state = {
|
||||
open: false,
|
||||
disabled: props.disabled || false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hasMenu() {
|
||||
return this.props.menu;
|
||||
}
|
||||
|
||||
isMenuOpen() { return this.state.open; }
|
||||
isDisabled() { return this.state.disabled; }
|
||||
|
||||
//Event Handlers
|
||||
onClick() {
|
||||
if(this.isDisabled()) return;
|
||||
if(this.hasMenu()) {
|
||||
this.setState({
|
||||
open: !this.state.open
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onMouseLeave() {
|
||||
if(!this.hasMenu()) return;
|
||||
if(!this.isMenuOpen()) return;
|
||||
|
||||
this.setState({
|
||||
open: false
|
||||
});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
//Add event listeners
|
||||
this.refs.button.addEventListener('click', this.onClickBound);
|
||||
this.refs.option.addEventListener('mouseleave', this.onMouseLeaveBound);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
//Remove event listeners
|
||||
this.refs.button.removeEventListener('click', this.onClickBound);
|
||||
this.refs.option.removeEventListener('mouseleave', this.onMouseLeaveBound);
|
||||
}
|
||||
|
||||
//Render method
|
||||
render() {
|
||||
let menu;
|
||||
let button;
|
||||
|
||||
if(this.props.menu) {
|
||||
menu = (
|
||||
<ContextMenu>
|
||||
{ this.props.menu }
|
||||
</ContextMenu>
|
||||
);
|
||||
clazz += " has-menu";
|
||||
}
|
||||
|
||||
if(this.props.href) {
|
||||
button = (
|
||||
<a href={this.props.href} className="o-window__menu-bar-button" ref="button" target={this.props.target}>
|
||||
{ this.props.title }
|
||||
</a>
|
||||
);
|
||||
} else if(this.props.to) {
|
||||
button = (
|
||||
<Link to={this.props.to} className="o-window__menu-bar-button" ref="button" target={this.props.target}>
|
||||
{ this.props.title }
|
||||
</Link>
|
||||
);
|
||||
} else {
|
||||
button = (
|
||||
<div className="o-window__menu-bar-button" ref="button">
|
||||
{this.props.title}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
let clazz = "o-window__menu-bar-option"
|
||||
if(this.props.disabled) {
|
||||
clazz += " is-disabled";
|
||||
}
|
||||
|
||||
if(this.state.open) {
|
||||
clazz += " is-active";
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={clazz} ref="option">
|
||||
{ button }
|
||||
{ menu }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
MenuOption
|
||||
};
|
69
public/window/TitleBar.jsx
Normal file
69
public/window/TitleBar.jsx
Normal file
@ -0,0 +1,69 @@
|
||||
// Copyright (c) 2018 Dominic Masters
|
||||
//
|
||||
// MIT License
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import React from 'react';
|
||||
|
||||
//Title Bar
|
||||
export default (props) => {
|
||||
return (
|
||||
<div className="o-window__title-bar">
|
||||
<div className="o-window__title-bar-buttons">
|
||||
{ props.buttons }
|
||||
</div>
|
||||
|
||||
<div className="o-window__title-bar-title">
|
||||
{ props.children }
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
//Buttons
|
||||
const TitleBarButton = (props) => {
|
||||
let clz = "o-window__title-bar-button";
|
||||
if(props.className) clz += " o-window__title-bar-button--"+props.className;
|
||||
if(props.disabled) clz += " is-disabled";
|
||||
return (
|
||||
<div className={clz}>
|
||||
{ props.children }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const Close = (props) => {
|
||||
return (
|
||||
<TitleBarButton {...props} className="close" title="Close" />
|
||||
);
|
||||
}
|
||||
|
||||
const Minimize = (props) => {
|
||||
return (
|
||||
<TitleBarButton {...props} className="minimize" title="Minimize" />
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
TitleBarButton,
|
||||
Close,
|
||||
Minimize
|
||||
}
|
53
public/window/Window95.jsx
Normal file
53
public/window/Window95.jsx
Normal file
@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2018 Dominic Masters
|
||||
//
|
||||
// MIT License
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import React from 'react';
|
||||
import TitleBar, { Close, Minimize } from './TitleBar';
|
||||
import MenuBar, { MenuOption } from './MenuBar';
|
||||
import ContextMenu, { ContextMenuOption } from './ContextMenu';
|
||||
import Frame from './Frame';
|
||||
import AddressBar from './AddressBar';
|
||||
|
||||
export default (props) => {
|
||||
return (
|
||||
<div className="o-window">
|
||||
{ props.children }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
TitleBar,
|
||||
Close,
|
||||
Minimize,
|
||||
|
||||
MenuBar,
|
||||
MenuOption,
|
||||
|
||||
ContextMenu,
|
||||
ContextMenuOption,
|
||||
|
||||
Frame,
|
||||
|
||||
AddressBar
|
||||
}
|
Reference in New Issue
Block a user