Skip to content
This repository was archived by the owner on Aug 26, 2022. It is now read-only.
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
Empty file removed src/App.css
Empty file.
11 changes: 0 additions & 11 deletions src/App.js

This file was deleted.

10 changes: 10 additions & 0 deletions src/App.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.edit-mode-container {
display: flex;
flex-direction: column;

& .button-module {
display: flex;
flex-direction: row;
align-self: flex-start;
}
}
9 changes: 0 additions & 9 deletions src/App.test.js

This file was deleted.

12 changes: 12 additions & 0 deletions src/DisplayView.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

export default function DisplayView() {
/************************************
* Render
************************************/

return (
<>
</>
);
}
34 changes: 34 additions & 0 deletions src/EditMode.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { useState } from 'react';
import './App.scss';

import EditView from './EditView';
import DisplayView from './DisplayView';

/************************************
* Constants
************************************/

const EDIT_VIEW = 'EDIT';
const DISPLAY_VIEW = 'DISPLAY';

export default function EditMode({width = '100%', height = '500px'}) {
/************************************
* State
************************************/

const [view, setView] = useState(EDIT_VIEW);

/************************************
* Render
************************************/

return (
<div className='edit-mode-container' style={{width: width, height: height}}>
<div className='button-module'>
<button onClick={() => {setView(EDIT_VIEW)}}>Edit</button>
<button onClick={() => {setView(DISPLAY_VIEW)}}>Preview</button>
</div>
{ view === EDIT_VIEW ? <EditView /> : <DisplayView /> }
</div>
);
}
11 changes: 11 additions & 0 deletions src/EditView.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

export default function EditView({onValueChange, ...rest}) {
/************************************
* Render
************************************/

return (
<textarea style={{height: 'inherit'}} {...rest} onChange={onValueChange}></textarea>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Any reason why you're setting the styling here as opposed to CSS?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The height of the 'EditMode' will be determined by the user passing down a height. This text area will calculate the height based off that passed in height (will be shorter at some point). Since it's dynamic i should be doing this styling inline.

Also from what i've seen these npm packages don't usually use style sheets. Need to determine the best way to do this. Might make the most sense to keep all functionality on a component since it's the one thing being imported

);
}
12 changes: 12 additions & 0 deletions src/LeifdownApp.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import EditMode from './EditMode';

export default function LeifdownApp() {
/************************************
* Render
************************************/

return (
<EditMode />
);
}
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import LeifdownApp from './LeifdownApp';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(
<React.StrictMode>
<App />
<LeifdownApp />
</React.StrictMode>,
document.getElementById('root')
);
Expand Down