Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: highlight and overflow issues #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ import Button from '../../../views/components/button';

import './sign-in-page.css';

// test for bug in react syntax highlighting
const WrapperComponent = ({children}) => <div className="g-row sign-in">{children}</div>

const SignInPage = ({signInWithGithub, signInWithGoogle, signInWithTwitter}) => {
return (
<div className="g-row sign-in">
<WrapperComponent>
<div className="g-col">
<h1 className="sign-in__heading">Sign in</h1>
<Button className="sign-in__button" onClick={signInWithGithub}>GitHub</Button>
<Button className="sign-in__button" onClick={signInWithGoogle}>Google</Button>
<Button className="sign-in__button" onClick={signInWithTwitter}>Twitter</Button>
</div>
</div>
</WrapperComponent>
);
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-redux": "^5.0.7",
"react-syntax-highlighter": "8.0.1",
"react-syntax-highlighter": "^10.3.0",
"redux": "^4.0.0",
"redux-persist": "^5.10.0",
"redux-saga": "^0.16.0",
Expand Down
6 changes: 5 additions & 1 deletion src/public/js/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
}

> .header {
position: relative;
position: fixed;
z-index: 1;
background: #fff;
width: 100%;
padding-right: 15px;
border-bottom: 1px solid #F5F5F5;
}

Expand Down
10 changes: 3 additions & 7 deletions src/public/js/components/sideBar/component/Code/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import SyntaxHighlighter from 'react-syntax-highlighter';
import { atomOneLight } from 'react-syntax-highlighter/styles/hljs';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import { vs } from 'react-syntax-highlighter/dist/esm/styles/prism';

import './index.scss';

Expand Down Expand Up @@ -49,13 +49,9 @@ export default class extends React.Component {
<div className={classNames('Code', { limitedHeight })} ref={el => (this.codeRef = el)}>
<SyntaxHighlighter
language={language}
style={atomOneLight}
style={vs}
showLineNumbers={true}
wrapLines={true}
customStyle={{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there is a way to provide custom styles to SyntaxHighlighter in this version? Need to be able to control that as it was done before

Copy link
Author

@magic-m-johnson magic-m-johnson May 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes there is. I removed this part only because it conflicted with the new theme I picked.

fontSize: `${fontSize || FONT_SIZE}px`,
padding: `${PADDING_TOP}px 0px 5px 5px`
}}
lineProps={lineNumber => {
if (isMatchLineNumber(crumbedLines, lineNumber)) {
return { className: 'crumbedLine' };
Expand Down
7 changes: 6 additions & 1 deletion src/public/js/components/sideBar/component/SideBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ export default ({
{standaloneNoCode ? (
<Skeleton />
) : (
<Code namespace={namespace} language={language} code={file.fileCode} />
<Code
crumbedLines={codeCrumbsDiagramOn ? file.children.map(({ crumbNodeLines }) => crumbNodeLines) : []}
namespace={namespace}
language={language}
code={file.fileCode}
/>
)}
</Suspense>
</TabPane>
Expand Down
5 changes: 3 additions & 2 deletions src/public/js/components/sideBar/component/SideBar.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.SideBar {
position: absolute;
position: fixed;
right: 0;
top: 0;
top: 42px;
height: 100%;
overflow: hidden;
width: 650px;
max-width: 100%;
z-index: 4;
background-color: white;
border-top: 1px solid #ebedf0;
border-left: 1px solid #ebedf0;
padding: 8px 16px;

Expand Down
8 changes: 5 additions & 3 deletions src/public/js/components/treeDiagram/TreeDiagramsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { Spin } from 'antd';
import StandalonePlaceholder from './component/StandalonePlaceholder';

import { getNamespacesList } from 'core/dataBus/selectors';
import { getCheckedState } from 'core/controlsBus/selectors';
import { getActiveNamespace } from 'core/namespaceIntegration/selectors';
import TreeDiagram from './component/TreeDiagram';

import './TreeDiagamsContainer.scss';

const TreeDiagramsContainer = ({ namespacesList, activeNamespace }) => {
const TreeDiagramsContainer = ({ namespacesList, activeNamespace, sideBar }) => {
if (!namespacesList.length) {
return process.env.STANDALONE ? (
<StandalonePlaceholder />
Expand All @@ -24,7 +25,7 @@ const TreeDiagramsContainer = ({ namespacesList, activeNamespace }) => {
}

return (
<div className={'TreeDiagramsContainer'}>
<div className={'TreeDiagramsContainer'} style={sideBar ? { width: 'calc(100% - 650px)' } : {}}>
{namespacesList.map(namespace => (
<TreeDiagram
key={namespace}
Expand All @@ -39,7 +40,8 @@ const TreeDiagramsContainer = ({ namespacesList, activeNamespace }) => {

const mapStateToProps = state => ({
activeNamespace: getActiveNamespace(state),
namespacesList: getNamespacesList(state)
namespacesList: getNamespacesList(state),
sideBar: getCheckedState(state).sideBar
});

export default connect(mapStateToProps)(TreeDiagramsContainer);
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const mapDispatchToProps = (dispatch, props) => {
const { namespace } = props;
return {
onCodeCrumbSelect: (event, options) => {
return event.metaKey
return event.metaKey || event.altKey
? dispatch(
selectNodeToOpenInEditor(
{ path: options.fileNode.path, line: options.codeCrumb.crumbNodeLines[0] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,13 @@ const SourceTree = props => {
{(sourceDiagramOn && sourceEdges) || null}
{(sourceDiagramOn && selectedSourceEdges) || null}

{dependenciesDiagramOn &&
selectedNode.dependencies && (
<DependenciesTree
namespace={namespace}
language={language}
shiftToCenterPoint={shiftToCenterPoint}
/>
)}
{dependenciesDiagramOn && selectedNode.dependencies && (
<DependenciesTree
namespace={namespace}
language={language}
shiftToCenterPoint={shiftToCenterPoint}
/>
)}

{(sourceDiagramOn && sourceNodes) || null}
{(sourceDiagramOn && sourceDotes) || null}
Expand Down