Skip to content

Fix/snowflake-integration #762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: epic/snowflake-membership
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import starlightDocSearch from '@astrojs/starlight-docsearch';
import lit from "@astrojs/lit";
import { rehypeHeadingIds } from '@astrojs/markdown-remark';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import { customElements, ceJsDoc, sfCustomElements, sfCEJsDoc } from "./src/scripts/custom-elements";
import { customElements, ceJsDoc } from "./src/scripts/custom-elements";
import badges from "./src/data/badge.json";
import { nucleusRemarkAside } from "./src/plugins/nucleus-remark-aside";

Expand Down Expand Up @@ -59,7 +59,8 @@ const componentSidebar = () => {
{
label: "Snowflakes",
items:
sfCEJsDoc.sort((ce1, ce2) => ce1.name > ce2.name ? 1 : -1)
ceJsDoc.filter((customElement) => customElement.category === 'Snowflakes' && !isDeprecated(customElement.name))
.sort((ce1, ce2) => ce1.name > ce2.name ? 1 : -1)
.map((customElement) => {
return {
label: customElement['display-name'],
Expand Down
2 changes: 0 additions & 2 deletions src/components/figma.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
import LinkToComponent from "./LinkToComponent.astro";
const { name } = Astro.props;
import { Icon } from "@astrojs/starlight/components";
import { ceJsDoc } from "../scripts/custom-elements";

// Define the common URL for the Figma UI Kit that prepends the node ID
const urlFigmaUIKit =
Expand Down
5 changes: 2 additions & 3 deletions src/components/placement.astro
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
import LinkToComponent from "./LinkToComponent.astro";
const { name } = Astro.props;
import { ceJsDoc, sfCEJsDoc } from "../scripts/custom-elements";
import { ceJsDoc } from "../scripts/custom-elements";

const placements = [...ceJsDoc, ...sfCEJsDoc].find((tag) => tag.name === name)?.placements;
console.log('placements ', placements);
const placements = ceJsDoc.find((tag) => tag.name === name)?.placements;
---
{
placements?.length > 0 && (
Expand Down
11 changes: 7 additions & 4 deletions src/components/specification.astro
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
---
import LinkToComponent from "./LinkToComponent.astro";
const { name } = Astro.props;
const { exclude } = Astro.props;

import { customElements, ceJsDoc, sfCustomElements, sfCEJsDoc } from "../scripts/custom-elements";
import { customElements, ceJsDoc } from "../scripts/custom-elements";

const compDetails = {...customElements, ...sfCustomElements}.tags.find((tag) => tag.name === name);
const jsdocDetails = [...ceJsDoc, ...sfCEJsDoc].find((tag) => tag.name === name);
const compDetails = customElements.tags.find((tag) => tag.name === name);
const jsdocDetails = ceJsDoc.find((tag) => tag.name === name);

const properties = compDetails?.properties;
const slots = jsdocDetails?.slots;
const events = compDetails?.events;

const excludedAttributes = exclude?.split(',').map((item) => item.trim());
---

<style>
Expand Down Expand Up @@ -43,7 +46,7 @@ const events = compDetails?.events;
<div class="description-list">
{
properties?.map((property) => {
if (!property.attribute || property.deprecated || ['slottedStyles'].includes(property.name)) {
if (!property.attribute || property.deprecated || ['slottedStyles'].includes(property.name) || excludedAttributes?.includes(property.attribute)) {
return undefined;
}
const defaultValue = property.default?.replaceAll('"', '');
Expand Down
4 changes: 1 addition & 3 deletions src/content/docs/components/nss-membership-card.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import Figma from '@components/figma.astro';

## Overview

**The purpose of the membership card is to provide details of a single offer or benefit exclusively for a particular customer.**

<CompDetails name={componentName} />

The snowflake `nss-membership-card` is specific to the 'membership wallet'. It utilises the membership styling and colour scheme that sets it apart from `ns-card`.
Expand Down Expand Up @@ -74,7 +72,7 @@ The snowflake `nss-membership-card` is specific to the 'membership wallet'. It u

### Specification

<Specification name={componentName} />
<Specification name={componentName} exclude='inactive, inactive-message, background, pill-over-image, decoration' />

### Figma

Expand Down
24 changes: 21 additions & 3 deletions src/scripts/custom-elements.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
import ceJsDoc from "@connectedhomes/nucleus/ce-doc.json";
import customElements from "@connectedhomes/nucleus/custom-elements.json";
import nsCEJsDoc from "@connectedhomes/nucleus/ce-doc.json";
import nsCustomElements from "@connectedhomes/nucleus/custom-elements.json";
import sfCEJsDoc from "@connectedhomes/nucleus-snowflakes/ce-doc.json";
import sfCustomElements from "@connectedhomes/nucleus-snowflakes/custom-elements.json";

export { customElements, ceJsDoc, sfCustomElements, sfCEJsDoc };
sfCEJsDoc.forEach((tag) => {
if (!tag.category) {
tag.category = tag.category ?? "Snowflakes";
}
});

const customElements = {
tags: [
...nsCustomElements.tags,
...sfCustomElements.tags,
]
};

const ceJsDoc = [
...nsCEJsDoc,
...sfCEJsDoc,
];

export { customElements, ceJsDoc };