Add config_display option to support regular and large renders (#310)
This commit is contained in:
@@ -140,6 +140,21 @@ It may increase filesize since it replace unicode characters by SVG images.
|
||||
config_twemoji: yes
|
||||
```
|
||||
|
||||
### ↔️ Controlling display size
|
||||
|
||||
Some templates like `classic` and `repositories` support different output display size:
|
||||
- `regular` (default) will render a medium-sized image, which is suitable for both desktop and mobile displays and is preferable when using data-intensive metrics (since text may be scaled down on small devices)
|
||||
- `large` will render a large-sized image, which may be more suitable for some plugins (like displaying topics icons, repository contributors, etc.)
|
||||
|
||||
#### ℹ️ Examples workflows
|
||||
|
||||
```yaml
|
||||
- uses: lowlighter/metrics@latest
|
||||
with:
|
||||
# ... other options
|
||||
config_display: large
|
||||
```
|
||||
|
||||
### 🎞️ SVG CSS Animations
|
||||
|
||||
As rendered metrics use HTML and CSS, some templates have animations.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//Setup
|
||||
export default async function({login, q}, {conf, data, rest, graphql, plugins, queries, account, convert, template}, {pending, imports}) {
|
||||
//Load inputs
|
||||
const {"config.animations":animations, "config.timezone":_timezone, "debug.flags":dflags} = imports.metadata.plugins.core.inputs({data, account, q})
|
||||
const {"config.animations":animations, "config.display":display, "config.timezone":_timezone, "debug.flags":dflags} = imports.metadata.plugins.core.inputs({data, account, q})
|
||||
imports.metadata.templates[template].check({q, account, format:convert})
|
||||
|
||||
//Init
|
||||
@@ -29,6 +29,9 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q
|
||||
}
|
||||
}
|
||||
|
||||
//Display
|
||||
data.large = display === "large"
|
||||
|
||||
//Animations
|
||||
data.animated = animations
|
||||
console.debug(`metrics/compute/${login} > animations ${data.animated ? "enabled" : "disabled"}`)
|
||||
|
||||
@@ -167,6 +167,15 @@ inputs:
|
||||
type: boolean
|
||||
default: yes
|
||||
|
||||
# Render display width
|
||||
config_display:
|
||||
description: Render display width
|
||||
type: string
|
||||
default: regular
|
||||
values:
|
||||
- regular # 480px width
|
||||
- large # 960px width (may not be supported by all templates)
|
||||
|
||||
# Enable SVG CSS animations
|
||||
config_animations:
|
||||
description: SVG CSS animations
|
||||
|
||||
Reference in New Issue
Block a user