Skip to content

Commit

Permalink
LWS-227: Extend formatter styling possibilites
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperengstrom committed Aug 23, 2024
1 parent f6e3f71 commit cae8186
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
4 changes: 3 additions & 1 deletion lxl-web/src/lib/assets/json/display-web.json
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@
"@type": "fresnel:Format",
"fresnel:classFormatDomain": ["Contribution"],
"fresnel:propertyFormatDomain": ["role"],
"fresnel:propertyStyle": ["secondary", "small"],
"fresnel:propertyFormat": {
"fresnel:contentBefore": " (",
"fresnel:contentFirst": "(",
Expand Down Expand Up @@ -473,7 +474,7 @@
"@id": "genreForm-format",
"@type": "fresnel:Format",
"fresnel:propertyFormatDomain": ["genreForm"],
"fresnel:propertyStyle": ["pill", "nolabel"],
"fresnel:propertyStyle": ["nolabel"],
"fresnel:valueFormat": {
"fresnel:contentBefore": "",
"fresnel:contentFirst": ""
Expand Down Expand Up @@ -670,6 +671,7 @@
"@type": "fresnel:Format",
"fresnel:classFormatDomain": ["Collection"],
"fresnel:propertyFormatDomain": ["sigel"],
"fresnel:propertyStyle": ["secondary", "small"],
"fresnel:propertyFormat": {
"fresnel:contentBefore": " (",
"fresnel:contentFirst": "(",
Expand Down
24 changes: 16 additions & 8 deletions lxl-web/src/lib/components/DecoratedData.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
{/if}
{:else}
{#if shouldShowContentBefore()}
<span class="_contentBefore">
<span class={`_contentBefore ${getStyleClasses(data)}`}>
{data._contentBefore}
</span>
{/if}
Expand Down Expand Up @@ -217,7 +217,11 @@
{:else}
{@const [propertyName, propertyData] = getProperty(data)}
{#if propertyName && propertyData}
<svelte:element this={getElementType(propertyData)} data-property={propertyName}>
<svelte:element
this={getElementType(propertyData)}
data-property={propertyName}
class={getStyleClasses(data)}
>
{#if shouldShowLabels()}
<svelte:element this={block ? 'div' : 'span'}>
<!-- Add inner span with inline-block to achieve first letter capitalization while still supporting inline whitespaces -->
Expand Down Expand Up @@ -245,7 +249,7 @@
{/if}
{/if}
{#if shouldShowContentAfter()}
<span class="_contentAfter">
<span class={`_contentAfter ${getStyleClasses(data)}`}>
{data._contentAfter}
</span>
{/if}
Expand All @@ -257,7 +261,15 @@

<style lang="postcss">
.definition {
@apply text-sm text-secondary underline decoration-dotted;
@apply underline decoration-dotted;
}
.small {
@apply text-sm;
}
.secondary {
@apply text-secondary;
}
.pill {
Expand All @@ -267,10 +279,6 @@
@apply hover:bg-pill/16 focus:bg-pill/16;
}
.text-large {
@apply text-lg;
}
.remainder {
@apply ml-2 whitespace-nowrap rounded-full bg-pill/8 px-2 py-0.5 text-secondary;
}
Expand Down

0 comments on commit cae8186

Please sign in to comment.