From 0be726aee447430465533b74463170a4b8072a1e Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Sun, 20 Aug 2017 11:55:11 -0600 Subject: [PATCH] Reorganize styles and DetailsSection menu code --- .../DetailsSection/index.jsx | 76 +++++++++++-------- .../DetailsSection/styles.scss | 11 +++ .../display/DictionaryDetails/index.jsx | 4 +- .../display/DictionaryDetails/styles.scss | 5 ++ src/components/management/SearchBox/index.jsx | 4 +- .../management/SearchBox/styles.scss | 25 ++++++ src/sass/_styles.scss | 27 ------- 7 files changed, 91 insertions(+), 61 deletions(-) create mode 100644 src/components/display/DictionaryDetails/DetailsSection/styles.scss create mode 100644 src/components/display/DictionaryDetails/styles.scss create mode 100644 src/components/management/SearchBox/styles.scss diff --git a/src/components/display/DictionaryDetails/DetailsSection/index.jsx b/src/components/display/DictionaryDetails/DetailsSection/index.jsx index e50c34f..7ea8b3c 100644 --- a/src/components/display/DictionaryDetails/DetailsSection/index.jsx +++ b/src/components/display/DictionaryDetails/DetailsSection/index.jsx @@ -3,6 +3,8 @@ import Component from 'inferno-component'; import marked from 'marked'; import sanitizeHtml from 'sanitize-html'; +import './styles.scss'; + import { PhonologyDisplay } from './PhonologyDisplay'; const DISPLAY = { @@ -32,35 +34,7 @@ export class DetailsSection extends Component { }); } - displayDetails () { - const { currentDisplay } = this.state; - const { details } = this.props; - const defaultMenuLength = this.defaultMenuItems.length; - - if (currentDisplay < defaultMenuLength) { - switch (this.defaultMenuItems[currentDisplay]) { - case 'Phonology': { - return - break; - } - case 'Grammar': { - return 'Grammar content!'; - break; - } - } - } else { - const sanitizedCustomTabContent = sanitizeHtml(details.custom[currentDisplay - defaultMenuLength].content); - return ( -
-
-
- ); - } - } - - render () { + displayMenu () { const { details } = this.props; let additionalMenu = ( @@ -87,8 +61,8 @@ export class DetailsSection extends Component {
); - const menu = ( -
+ return ( +

Linguistics

@@ -110,11 +84,49 @@ export class DetailsSection extends Component {
); + } + displayDetails () { + const { currentDisplay } = this.state; + const { details } = this.props; + const defaultMenuLength = this.defaultMenuItems.length; + + let detailsDisplay = ''; + + if (currentDisplay < defaultMenuLength) { + switch (this.defaultMenuItems[currentDisplay]) { + case 'Phonology': { + detailsDisplay = + break; + } + case 'Grammar': { + detailsDisplay = 'Grammar content!'; + break; + } + } + } else { + const sanitizedCustomTabContent = sanitizeHtml(details.custom[currentDisplay - defaultMenuLength].content); + detailsDisplay = ( +
+
+
+ ); + } + + return ( +
+ { detailsDisplay } +
+ ); + } + + render () { return (
{ this.displayDetails() } diff --git a/src/components/display/DictionaryDetails/DetailsSection/styles.scss b/src/components/display/DictionaryDetails/DetailsSection/styles.scss new file mode 100644 index 0000000..da2c107 --- /dev/null +++ b/src/components/display/DictionaryDetails/DetailsSection/styles.scss @@ -0,0 +1,11 @@ +@import '../../../../../node_modules/bulma/bulma'; + +.details-menu { + @extend .menu; +} + +.details-menu, +.details-display { + max-height: 500px; + overflow-y: auto; +} \ No newline at end of file diff --git a/src/components/display/DictionaryDetails/index.jsx b/src/components/display/DictionaryDetails/index.jsx index c838f63..947b0aa 100644 --- a/src/components/display/DictionaryDetails/index.jsx +++ b/src/components/display/DictionaryDetails/index.jsx @@ -3,6 +3,8 @@ import Component from 'inferno-component'; import marked from 'marked'; import sanitizeHtml from 'sanitize-html'; +import './styles.scss'; + import { EditDictionaryModal } from '../../management/EditDictionaryModal'; import { DetailsSection } from './DetailsSection'; @@ -76,7 +78,7 @@ export class DictionaryDetails extends Component { } return ( -
+
{ displayJSX }
) diff --git a/src/components/display/DictionaryDetails/styles.scss b/src/components/display/DictionaryDetails/styles.scss new file mode 100644 index 0000000..806147a --- /dev/null +++ b/src/components/display/DictionaryDetails/styles.scss @@ -0,0 +1,5 @@ +@import '../../../../node_modules/bulma/bulma'; + +.details-box { + @extend .box; +} \ No newline at end of file diff --git a/src/components/management/SearchBox/index.jsx b/src/components/management/SearchBox/index.jsx index 8e39a0e..420130e 100644 --- a/src/components/management/SearchBox/index.jsx +++ b/src/components/management/SearchBox/index.jsx @@ -1,6 +1,8 @@ import Inferno from 'inferno'; import Component from 'inferno-component'; +import './styles.scss'; + import Helper from '../../../Helper'; import dictionary from '../../../managers/DictionaryData'; @@ -249,7 +251,7 @@ export class SearchBox extends Component {

-

diff --git a/src/components/management/SearchBox/styles.scss b/src/components/management/SearchBox/styles.scss new file mode 100644 index 0000000..e77206a --- /dev/null +++ b/src/components/management/SearchBox/styles.scss @@ -0,0 +1,25 @@ +@import '../../../../node_modules/bulma/bulma'; + +.open-search-input { + @extend .input; + cursor: pointer; +} + +.search-bar { + @extend .hero; + background: transparent; + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 100; + + .search-body { + @extend .hero-body; + @extend .is-paddingless; + + .search-background { + @extend .modal-background; + } + } +} \ No newline at end of file diff --git a/src/sass/_styles.scss b/src/sass/_styles.scss index d9c64e5..c4a157a 100644 --- a/src/sass/_styles.scss +++ b/src/sass/_styles.scss @@ -1,33 +1,6 @@ @import 'variables'; @import '../../node_modules/bulma/bulma'; -.input { - &[readonly] { - &.is-clickable { - cursor: pointer; - } - } -} - -.search-bar { - @extend .hero; - background: transparent; - position: fixed; - top: 0; - left: 0; - right: 0; - z-index: 100; - - .search-body { - @extend .hero-body; - @extend .is-paddingless; - - .search-background { - @extend .modal-background; - } - } -} - .modal-card-title { word-wrap: break-word; max-width: 100%;