Skip to content

Commit

Permalink
Merge pull request #11 from japamat/rithm-move-calc-with-panes
Browse files Browse the repository at this point in the history
slide calculator over with expanded pane [issue desmosinc#48]
  • Loading branch information
misscoded authored Jun 25, 2019
2 parents 7a0aecd + 3b6b2b2 commit b45310d
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 6 deletions.
16 changes: 15 additions & 1 deletion src/components/App.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
.calculator {
z-index: 1;
position: absolute;
top: 60px;
left: 70px;
right: 0;
bottom: 0;
}

.calculator-burst,
.calculator-settings {
left: 271px;
}

.calculator-none,
.calculator-preview {
left: 70px;
}

.calculator-files {
left: 449px;
}
4 changes: 3 additions & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ class App extends Component {
}

render() {
const { pane } = this.props;

return (
<div className="App">
<Header />
<div className="calculator" ref={calcContainer} />
<div className={`calculator calculator-${pane}`} ref={calcContainer} />
<SettingsContainer />
<PreviewContainer />
<BurstContainer />
Expand Down
4 changes: 3 additions & 1 deletion src/components/Header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ describe('<Header/>', () => {

it('renders appropriate content', () => {
const { getByTestId } = global.renderWithRedux(<Header />);
expect(getByTestId('Header-logo').textContent).toBe('GIFsmos');
expect(getByTestId('Header-logo').firstChild.src).toContain(
'gifsmos-logo.svg'
);
expect(getByTestId('Header-help').textContent).toMatch('Paste');
});
});
1 change: 1 addition & 0 deletions src/components/Preview.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
}

.Preview-expanded {
z-index: 1;
transform: translateX(0);
transition: 0.2s transform;
}
Expand Down
1 change: 1 addition & 0 deletions src/components/Sidebar.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.Sidebar {
position: absolute;
z-index: 2;
top: 60px;
left: 0;
bottom: 0;
Expand Down
14 changes: 14 additions & 0 deletions src/containers/AppContainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { connect } from 'react-redux';
import App from '../components/App';

const mapStateToProps = (state, ownProps) => {
const { expandedPane } = state.ui;

return {
pane: expandedPane.toLowerCase()
};
};

const AppContainer = connect(mapStateToProps)(App);

export default AppContainer;
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createStore, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import thunkMiddleware from 'redux-thunk';
import rootReducer from './reducers';
import App from './components/App';
import AppContainer from './containers/AppContainer';
import panes from './constants/pane-types';
import { togglePane } from './actions';
import greet from './lib/dev-greeting';
Expand All @@ -16,7 +16,7 @@ const closePane = () => store.dispatch(togglePane(panes.NONE));

ReactDOM.render(
<Provider store={store}>
<App onEscape={closePane} />
<AppContainer onEscape={closePane} />
</Provider>,
document.getElementById('root')
);
Expand Down
1 change: 0 additions & 1 deletion src/lib/calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ let calculator;

function initializeCalculator(desmos, calcContainer, calcOptions) {
calculator = desmos.GraphingCalculator(calcContainer.current, calcOptions);
window.calculator = calculator;
return calculator;
}

Expand Down

0 comments on commit b45310d

Please sign in to comment.