mirror of
https://github.com/Alamantus/Lexiconga.git
synced 2025-08-17 11:11:12 +02:00
Add GeneralDisplay tab
This commit is contained in:
parent
49e7788a59
commit
edbe5cbcb0
3 changed files with 96 additions and 14 deletions
|
@ -0,0 +1,58 @@
|
||||||
|
import Inferno from 'inferno';
|
||||||
|
import Component from 'inferno-component';
|
||||||
|
|
||||||
|
export const GeneralDisplay = ({
|
||||||
|
partsOfSpeech,
|
||||||
|
alphabeticalOrder,
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className='columns'>
|
||||||
|
|
||||||
|
<div className='column'>
|
||||||
|
<strong>Parts of Speech:</strong>
|
||||||
|
<div className='tags'>
|
||||||
|
{
|
||||||
|
partsOfSpeech.map(consonant => {
|
||||||
|
return (
|
||||||
|
<span key={`partOfSpeech_${ consonant }_${ Date.now().toString() }`}
|
||||||
|
className='tag'>
|
||||||
|
{ consonant }
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className='columns'>
|
||||||
|
|
||||||
|
<div className='column'>
|
||||||
|
<strong>Alphabetical Order:</strong>
|
||||||
|
<div className='tags'>
|
||||||
|
{
|
||||||
|
(alphabeticalOrder.length > 0)
|
||||||
|
? alphabeticalOrder.map(vowel => {
|
||||||
|
return (
|
||||||
|
<span key={`vowel_${ vowel }_${ Date.now().toString() }`}
|
||||||
|
className='tag'>
|
||||||
|
{ vowel }
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
: (
|
||||||
|
<span className='tag'>
|
||||||
|
English Alphabet
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import sanitizeHtml from 'sanitize-html';
|
||||||
|
|
||||||
import './styles.scss';
|
import './styles.scss';
|
||||||
|
|
||||||
|
import { GeneralDisplay } from './GeneralDisplay';
|
||||||
import { PhonologyDisplay } from './PhonologyDisplay';
|
import { PhonologyDisplay } from './PhonologyDisplay';
|
||||||
|
|
||||||
const DISPLAY = {
|
const DISPLAY = {
|
||||||
|
@ -19,6 +20,7 @@ export class DetailsSection extends Component {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.defaultMenuItems = [
|
this.defaultMenuItems = [
|
||||||
|
'General',
|
||||||
'Phonology',
|
'Phonology',
|
||||||
'Grammar',
|
'Grammar',
|
||||||
];
|
];
|
||||||
|
@ -67,7 +69,8 @@ export class DetailsSection extends Component {
|
||||||
Linguistics
|
Linguistics
|
||||||
</p>
|
</p>
|
||||||
<ul className='menu-list'>
|
<ul className='menu-list'>
|
||||||
{this.defaultMenuItems.map((tab, index) => {
|
{
|
||||||
|
this.defaultMenuItems.map((tab, index) => {
|
||||||
return (
|
return (
|
||||||
<li key={ `${ tab }_${ index }_${ Date.now().toString() }` }>
|
<li key={ `${ tab }_${ index }_${ Date.now().toString() }` }>
|
||||||
<a className={(this.state.currentDisplay === index) ? 'is-active' : null}
|
<a className={(this.state.currentDisplay === index) ? 'is-active' : null}
|
||||||
|
@ -77,7 +80,8 @@ export class DetailsSection extends Component {
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{ additionalMenu }
|
{ additionalMenu }
|
||||||
|
@ -88,15 +92,30 @@ export class DetailsSection extends Component {
|
||||||
|
|
||||||
displayDetails () {
|
displayDetails () {
|
||||||
const { currentDisplay } = this.state;
|
const { currentDisplay } = this.state;
|
||||||
const { details } = this.props;
|
const {
|
||||||
|
partsOfSpeech,
|
||||||
|
alphabeticalOrder,
|
||||||
|
details,
|
||||||
|
} = this.props;
|
||||||
const defaultMenuLength = this.defaultMenuItems.length;
|
const defaultMenuLength = this.defaultMenuItems.length;
|
||||||
|
|
||||||
let detailsDisplay = '';
|
let detailsDisplay = '';
|
||||||
|
|
||||||
if (currentDisplay < defaultMenuLength) {
|
if (currentDisplay < defaultMenuLength) {
|
||||||
switch (this.defaultMenuItems[currentDisplay]) {
|
switch (this.defaultMenuItems[currentDisplay]) {
|
||||||
|
case 'General': {
|
||||||
|
detailsDisplay = (
|
||||||
|
<GeneralDisplay
|
||||||
|
partsOfSpeech={ partsOfSpeech }
|
||||||
|
alphabeticalOrder={ alphabeticalOrder } />
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'Phonology': {
|
case 'Phonology': {
|
||||||
detailsDisplay = <PhonologyDisplay phonologyContent={details.phonology} />
|
detailsDisplay = (
|
||||||
|
<PhonologyDisplay
|
||||||
|
phonologyContent={ details.phonology } />
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'Grammar': {
|
case 'Grammar': {
|
||||||
|
|
|
@ -63,7 +63,12 @@ export class DictionaryDetails extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
case DISPLAY.DETAILS : {
|
case DISPLAY.DETAILS : {
|
||||||
displayJSX = <DetailsSection details={ this.props.details } />;
|
displayJSX = (
|
||||||
|
<DetailsSection
|
||||||
|
partsOfSpeech={ this.props.partsOfSpeech }
|
||||||
|
alphabeticalOrder={ this.props.alphabeticalOrder }
|
||||||
|
details={ this.props.details } />
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue