forked from nf-core/website
-
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 nf-core#2744 from mashehu/fix-modules-description
Fix modules parameter tables
- Loading branch information
Showing
10 changed files
with
201 additions
and
55 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
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
49 changes: 49 additions & 0 deletions
49
sites/main-site/src/components/component/ComponentParamItem.astro
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,49 @@ | ||
--- | ||
import { Markdown } from '@astropub/md'; | ||
import ComponentParamList from './ComponentParamList.astro'; | ||
const { name, value, depth = 0, lastItem = false } = Astro.props; | ||
const { type, description, pattern } = value; | ||
const hasNestedParams = Array.isArray(value) || (typeof value === 'object' && !type); | ||
--- | ||
|
||
{ | ||
name.slice(0, 6) !== 'input[' && ( | ||
<div | ||
class:list={[ | ||
`row align-items-center ${depth > 0 ? 'ms-' + depth * 2 : ''}`, | ||
{ 'border-bottom': !lastItem }, | ||
]} | ||
> | ||
<div class="col-12 col-md-4 col-xxl-3 small-h"> | ||
<h4 id={name + '_' + depth} class="module-row-name-id d-flex align-items-center mb-0 text-start"> | ||
<code> | ||
{name} | ||
{type && <span class="opacity-75 ms-0 small">:{type}</span>} | ||
</code> | ||
<a href={'#' + name + '_' + depth} class="header-link scroll_to_link me-2 mb-2"> | ||
<span class="fas fa-link" aria-hidden="true" /> | ||
</a> | ||
</h4> | ||
</div> | ||
<div class={`col-12 description py-1 small col-md-${pattern ? '5' : '7'}`}> | ||
{description && <Markdown of={description.replace(/(\n)/g, ' \n').replace(/\*./g, '\\*.')} />} | ||
</div> | ||
<div class={`col-12 col-md-${pattern ? '4' : '1'} ms-auto`}> | ||
{pattern && <code class="float-end pattern">{pattern}</code>} | ||
</div> | ||
</div> | ||
) | ||
} | ||
{ | ||
hasNestedParams && ( | ||
<div class="col-12 nested"> | ||
<ComponentParamList params={value} depth={depth + 1} /> | ||
</div> | ||
) | ||
} | ||
<style> | ||
.description :global(p) { | ||
margin-bottom: 0; | ||
} | ||
</style> |
23 changes: 23 additions & 0 deletions
23
sites/main-site/src/components/component/ComponentParamList.astro
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,23 @@ | ||
--- | ||
import ParameterItem from './ComponentParamItem.astro'; | ||
const { params, depth = 0 } = Astro.props; | ||
--- | ||
|
||
{ | ||
params.map((param, i) => { | ||
const [name, value] = Object.entries(param)[0]; | ||
return ( | ||
<div class:list={[{ 'card card-body mt-3 py-1': depth === 0 }]}> | ||
<ParameterItem | ||
name={name} | ||
value={value} | ||
depth={depth} | ||
lastItem={i === params.length - 1 && depth > 0} | ||
/> | ||
</div> | ||
); | ||
}) | ||
} | ||
|
||
<style></style> |
62 changes: 20 additions & 42 deletions
62
sites/main-site/src/components/component/ComponentParamTable.astro
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
81 changes: 81 additions & 0 deletions
81
sites/main-site/src/components/component/SubworkflowParamTable.astro
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,81 @@ | ||
--- | ||
import { Markdown } from '@astropub/md'; | ||
let { name, icon, params = [] } = Astro.props; | ||
export interface Props { | ||
name: string; | ||
icon: string; | ||
params?: any[]; | ||
} | ||
--- | ||
|
||
<h2 id={name.toLowerCase()} class="text-success ms-n3"> | ||
<i class={`fad ${icon} fa-fw`}></i> | ||
{name} | ||
<a href={'#' + name.toLowerCase()} class="header-link scroll_to_link" | ||
><span class="fas fa-link" aria-hidden="true"></span> | ||
</a> | ||
</h2> | ||
|
||
{ | ||
params ? ( | ||
<div class="row border-bottom border-3"> | ||
<div class="col-12 col-md-3 col-xxl-2"> | ||
<span class="text-body-secondary"> | ||
name<span class="ps-0 font-monospace opacity-75 small">:type</span> | ||
</span> | ||
</div> | ||
<div class="col-12 col-md-6"> | ||
<span class="text-body-secondary text-start">description</span> | ||
</div> | ||
<div class="col-12 col-md"> | ||
<span class="text-body-secondary float-end">pattern</span> | ||
</div> | ||
</div> | ||
) : ( | ||
'' | ||
) | ||
} | ||
{ | ||
params ? ( | ||
params.map((param) => { | ||
const name = Object.keys(param)[0]; | ||
const { type, description, pattern } = param[name]; | ||
return ( | ||
<div class="row border-bottom align-items-center"> | ||
<div class="col-12 col-md-3 col-xxl-2 small-h"> | ||
<h4 id={name} class="module-row-name-id d-flex align-items-center mb-0"> | ||
<code> | ||
{name} | ||
{type && <span class="opacity-75 small">:{type}</span>} | ||
</code> | ||
<a href={'#' + name} class="header-link scroll_to_link me-2 mb-2"> | ||
<span class="fas fa-link" aria-hidden="true" /> | ||
</a> | ||
</h4> | ||
</div> | ||
|
||
<div class={'col-12 description py-1 small col-md-' + (pattern ? '5' : '7')}> | ||
<Markdown of={description?.replace(/(\n)/g, ' \n').replace(/\*./g, '\\*.')} /> | ||
</div> | ||
<div class={'col-12 col-md-' + (pattern ? '4' : '1') + ' ms-auto'}> | ||
{pattern && <code class="float-end pattern">{pattern}</code>} | ||
</div> | ||
</div> | ||
); | ||
}) | ||
) : ( | ||
<p class="text-body-secondary">No input parameters</p> | ||
) | ||
} | ||
<style> | ||
h4 { | ||
overflow: hidden; | ||
} | ||
.description :global(p) { | ||
margin-bottom: 0; | ||
} | ||
.pattern { | ||
line-break: anywhere; | ||
} | ||
</style> |
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
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