Skip to content

Commit

Permalink
Merge branch 'master' into temporary-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-henz committed Jun 14, 2021
2 parents 6773d46 + b27072d commit dbe63e0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
19 changes: 6 additions & 13 deletions src/pages/sicp/Sicp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import classNames from 'classnames';
import * as React from 'react';
import { useDispatch } from 'react-redux';
import { RouteComponentProps, useParams } from 'react-router';
import ContentDisplay from 'src/commons/ContentDisplay';
import Constants from 'src/commons/utils/Constants';
import { resetWorkspace, toggleUsingSubst } from 'src/commons/workspace/WorkspaceActions';
import { parseArr, ParseJsonError } from 'src/features/sicp/parser/ParseJson';
Expand Down Expand Up @@ -33,17 +32,7 @@ export const mathjaxConfig = {
}
};

const sicpDisplayProps = {
fullWidth: false,
loadContentDispatch: () => {}
};

const loadingComponent = (
<ContentDisplay
{...sicpDisplayProps}
display={<NonIdealState title="Loading Content" icon={<Spinner />} />}
/>
);
const loadingComponent = <NonIdealState title="Loading Content" icon={<Spinner />} />;

const unexpectedError = (
<div>
Expand Down Expand Up @@ -163,7 +152,11 @@ const Sicp: React.FC<SicpProps> = props => {
<CodeSnippetContext.Provider value={{ active: active, setActive: handleSnippetEditorOpen }}>
<div ref={topRef} />
<MathJaxContext version={3} config={mathjaxConfig}>
{loading ? loadingComponent : <ContentDisplay {...sicpDisplayProps} display={data} />}
{loading ? (
<div className="sicp-content">{loadingComponent}</div>
) : (
<div className="sicp-content">{data}</div>
)}
</MathJaxContext>
</CodeSnippetContext.Provider>
</div>
Expand Down
5 changes: 2 additions & 3 deletions src/pages/sicp/__tests__/Sicp.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { mount, shallow } from 'enzyme';
import { Provider } from 'react-redux';
import ReactRouter from 'react-router';
import ContentDisplay from 'src/commons/ContentDisplay';
import { mockInitialStore } from 'src/commons/mocks/StoreMocks';

import Sicp from '../Sicp';
Expand Down Expand Up @@ -36,7 +35,7 @@ describe('Sicp renders', () => {
</Provider>
);
const wrapper = mount(sicp);
const display = wrapper.find(ContentDisplay);
expect(display.prop('display')).toEqual(<SicpIndexPage />);
const display = wrapper.find('.sicp-content');
expect(display.prop('children')).toEqual(<SicpIndexPage />);
});
});
23 changes: 15 additions & 8 deletions src/styles/_sicp.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ $sicp-background-color: #ffffff;
text-align: justify;
color: $sicp-text-color;
overflow: auto;
background-color: $sicp-background-color;

@media only screen and (max-width: 768px) {
font-size: 1em;
Expand All @@ -31,18 +32,25 @@ $sicp-background-color: #ffffff;
background-color: $sicp-background-color;
}

.ContentDisplay {
margin: 0 auto;
.sicp-content {
margin: 1em auto;
padding: 0 5em;
max-width: 1300px;

height: fit-content;
text-align: left;
background-color: $sicp-background-color;

.bp3-card {
background-color: $sicp-background-color;
h1 {
text-align: left;
}

p {
display: inline;
}

@media only screen and (max-width: 768px) {
padding: 0 1em;
}
}

.bp3-heading {
Expand Down Expand Up @@ -184,11 +192,10 @@ $sicp-background-color: #ffffff;
}

.sicp-toc-drawer {
background-color: $cadet-color-2;
width: 500px;
width: 500px !important;

.sicp-toc-tree {
color: $cadet-color-4;
color: $sicp-text-color;
font-size: larger;

.bp3-tree-node-content {
Expand Down

0 comments on commit dbe63e0

Please sign in to comment.