Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jun 7, 2024
1 parent 76f071a commit 254736b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
9 changes: 7 additions & 2 deletions engine/front-end/src/Components/Press.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ const PRESS = [
image: ImageLinuxMagazin,
link: 'http://www.linux-magazin.de/ausgaben/2018/04/io-broker/',
},
{title: '2017.08', alt: 'C\'t', image: ImageCT, link: 'https://www.heise.de/select/ct/2017/18/1503875643519180'},
{
title: '2017.08',
alt: 'C\'t',
image: ImageCT,
link: 'https://www.heise.de/select/ct/2017/18/1503875643519180',
},
{
title: '2017.07',
alt: 'Linux Magazin',
Expand All @@ -95,7 +100,7 @@ class Press extends Component {
<div className={this.props.classes.title}>{I18n.t('ioBroker in The Press')}</div>
<div className={this.props.classes.preBox}>
<div className={this.props.classes.box}>
{PRESS.map((p, i) => <div key={ i } className={this.props.classes.card} onClick={() => Utils.openLink(p.link)}>
{PRESS.map((p, i) => <div key={i} className={this.props.classes.card} onClick={() => Utils.openLink(p.link)}>
<img className={`${this.props.classes.cardLink} ${this.props.mobile ? this.props.classes.cardLinkMobile : ''}`} src={p.image} alt={p.alt} />
<div className={this.props.classes.cardTitle}>{p.title}</div>
</div>)}
Expand Down
1 change: 1 addition & 0 deletions engine/front-end/src/MDPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class MDPage extends Component {
scrollPosition={top => {
if (top !== undefined) {
this.contentRef.current.parentNode.scrollTop = top;
return top;
} else {
return this.contentRef.current.parentNode.scrollTop;
}
Expand Down
33 changes: 19 additions & 14 deletions engine/front-end/src/Markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ const CONVERTER_OPTIONS = {
splitAdjacentBlockquotes: true,
};

let title;
let gTitle;

const ADAPTER_CARD = ['version', 'authors', 'keywords', 'mode', 'materialize', 'compact'];

Expand Down Expand Up @@ -399,8 +399,8 @@ class Markdown extends Router {
hideContent: window.localStorage ? window.localStorage.getItem('Docs.hideContent') === 'true' : false,
};

if (!title) {
title = window.title;
if (!gTitle) {
gTitle = window.title;
}

this.mounted = false;
Expand Down Expand Up @@ -450,7 +450,9 @@ class Markdown extends Router {
</a></span>);
}
*/
this.customH = ({ text, id, level, prefix }) => {
this.customH = ({
text, id, level, prefix,
}) => {
const _level = parseInt(level, 10);

if (_level === 1) {
Expand Down Expand Up @@ -516,7 +518,7 @@ class Markdown extends Router {
}
}

onHashChange(location) {
static onHashChange(location) {
location = location || Router.getLocation();
if (location.chapter) {
const el = window.document.getElementById(location.chapter);
Expand Down Expand Up @@ -615,7 +617,7 @@ class Markdown extends Router {
title: _title,
});

this.onHashChange && setTimeout(() => this.onHashChange(), 200);
this.onHashChange && setTimeout(() => Markdown.onHashChange(), 200);
}

load(path, language) {
Expand Down Expand Up @@ -649,7 +651,9 @@ class Markdown extends Router {
title,
} = Utils.decorateText(body, header, `${this.props.path && (this.props.path[0] === '/' ? this.props.path : `/${this.props.path}`)}`);

return { header, parts, content, license, changeLog, title };
return {
header, parts, content, license, changeLog, title,
};
}

formatAuthors(text) {
Expand Down Expand Up @@ -730,7 +734,10 @@ class Markdown extends Router {
<List>{ADAPTER_CARD
.filter(attr => this.state.header.hasOwnProperty(attr))
.map(attr => <ListItem key={attr} className={this.props.classes.adapterCardListItem}>
<div className={this.props.classes.adapterCardAttr}>{I18n.t(attr)}: </div>
<div className={this.props.classes.adapterCardAttr}>
{I18n.t(attr)}
<span>: </span>
</div>
<span>{attr === 'authors' ? this.formatAuthors(this.state.header[attr]) : this.state.header[attr].toString()}</span>
</ListItem>)}
</List>
Expand Down Expand Up @@ -839,12 +846,10 @@ class Markdown extends Router {
const level = this.state.content[item].level;
let title = this.state.content[item].title.replace('&gt;', '>').replace('&lt;', '<').replace('&amp;', '&');

return (
<li key={title} style={{ fontSize: 16 - level * 2, paddingLeft: level * 8, fontWeight: !level ? 'bold' : 'normal' }}>
<span onClick={() => this.onNavigate(item, link)} className={this.props.classes.contentLinks}>{title}</span>
{this.state.content[item].children ? this._renderSubContent(this.state.content[item]) : null}
</li>
);
return <li key={title} style={{ fontSize: 16 - level * 2, paddingLeft: level * 8, fontWeight: !level ? 'bold' : 'normal' }}>
<span onClick={() => this.onNavigate(item, link)} className={this.props.classes.contentLinks}>{title}</span>
{this.state.content[item].children ? this._renderSubContent(this.state.content[item]) : null}
</li>;
})
.filter(e => e)}
</ul>
Expand Down

0 comments on commit 254736b

Please sign in to comment.