This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from lars-reimann/Dokumenations-Anzeige-Schoen…
…-Machen Dokumenations anzeige schoen machen
- Loading branch information
Showing
6 changed files
with
117 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React, {useState} from "react"; | ||
import "./ParameterView.css"; | ||
|
||
// @ts-ignore | ||
const DocumentationText = ({inputText}) => { | ||
|
||
const [readMore,setReadMore] = useState(false); | ||
const moreTextOption = inputText.length > 50 | ||
|
||
const linkName = readMore ? '[Read less]' : '[Read more]' | ||
|
||
return ( | ||
<div> | ||
<p>{!readMore && inputText.substr(0, 50)} | ||
{readMore && inputText} | ||
<button className="read-more-button" onClick={()=>{setReadMore(!readMore)}}> | ||
{moreTextOption && linkName} | ||
</button> | ||
</p> | ||
|
||
</div> | ||
); | ||
}; | ||
|
||
export default DocumentationText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from "react"; | ||
import "./ParameterView.css"; | ||
import DocumentationText from "./DocumentationText"; | ||
import PythonParameter from "../../model/PythonParameter"; | ||
|
||
type ParameterProps = {inputParameter: PythonParameter} | ||
|
||
const ParameterNode = ({inputParameter}: ParameterProps) => { | ||
return ( | ||
<div className="parametersList"> | ||
|
||
<span className="parameter-name"> | ||
<h4>{inputParameter?.name}</h4> | ||
</span> | ||
|
||
<DocumentationText inputText={inputParameter?.docstring}/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ParameterNode; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.parameterViewDiv{ | ||
position: -webkit-sticky; | ||
position: sticky; | ||
top: 0; | ||
padding-right: 1rem; | ||
} | ||
|
||
.parameterViewDiv h2{ | ||
padding-top: 1rem; | ||
padding-left: 1rem; | ||
} | ||
|
||
.parameterViewDiv a{ | ||
padding-left: .5rem; | ||
} | ||
|
||
.parametersList { | ||
padding-left: 1rem; | ||
padding-bottom: .5rem; | ||
} | ||
|
||
.parameter-name { | ||
font-weight: bold; | ||
} | ||
|
||
.visibility-indicator { | ||
display: inline-block; | ||
width: 1rem; | ||
} | ||
|
||
.read-more-button { | ||
background: none!important; | ||
border: none; | ||
/*padding: 0!important;*/ | ||
padding-left: 0.5rem; | ||
/*optional*/ | ||
font-family: arial, sans-serif; | ||
/*input has OS specific font-family*/ | ||
color: #069; | ||
text-decoration: underline; | ||
cursor: pointer; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import ParameterNode from "./ParameterNode"; | ||
import React from "react"; | ||
import PythonParameter from "../../model/PythonParameter"; | ||
|
||
type ParameterViewProps = {inputParameters: PythonParameter[]} | ||
|
||
const ParameterView = ({inputParameters}: ParameterViewProps) => { | ||
|
||
return ( | ||
|
||
<div className="parameterViewDiv"> | ||
<h2>Parameters</h2> | ||
{ | ||
inputParameters?.map(function (parameters) { | ||
return (<ParameterNode key={parameters.name} inputParameter={parameters} />) | ||
}) | ||
} | ||
|
||
</div> | ||
) | ||
}; | ||
|
||
export default ParameterView; | ||
|