### Install Dependencies and Start Server (Yarn) Source: https://github.com/mi6/ic-design-system/blob/main/CONTRIBUTING.md Install project dependencies using Yarn and start the development server. This involves removing the package-lock.json file before running yarn install. ```bash rm package-lock.json yarn install yarn run start ``` -------------------------------- ### Install Dependencies and Start Server (NPM) Source: https://github.com/mi6/ic-design-system/blob/main/CONTRIBUTING.md Install project dependencies using npm and start the development server. Use --legacy-peer-deps if encountering peer dependency issues. ```bash npm install --legacy-peer-deps npm start ``` -------------------------------- ### Webpack Entry Point Setup Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/get-started/web-components.mdx Configure the entry file for Webpack to import fonts, core styles, and define custom elements. This example assumes the entry file is src/index.js. ```jsx //src/index.js import "@ukic/fonts/dist/fonts.css"; import "@ukic/web-components/dist/core/core.css"; import { defineCustomElements } from "@ukic/web-components/loader"; defineCustomElements(); ``` -------------------------------- ### Install and Run ICDS Website Locally Source: https://github.com/mi6/ic-design-system/blob/main/README.md Commands to install dependencies, start the development server, and build the production version of the ICDS website. ```bash // dev mode npm i npm run start // production build outputs to ./dist npm run clean npm run build ``` -------------------------------- ### Web Component Tabs - Compact Example Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/components/navigation/tabs/code.mdx This snippet shows how to implement a compact tab interface using the IcTabContext, IcTabGroup, IcTab, and IcTabPanel web components. It requires no additional setup beyond including the components. ```html Ingredients Method History Drinks Recipes Tab One - Ingredients Tab Two - Method Tab Three - History Tab Four - Drinks Tab Five - Recipes ``` -------------------------------- ### Component Test File Example Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/get-started/testing-with-jest-and-rtl.mdx This example demonstrates testing a specific component, likely involving rendering it and asserting its initial state or behavior. ```javascript import { render, screen } from "@testing-library/react"; import Component from "./Component"; describe("Component", () => { it("renders correctly", () => { render(); expect(screen.getByText("Some Text")).toBeInTheDocument(); }); }); ``` -------------------------------- ### Top Navigation with various components Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/patterns/top-navigation-layout.mdx Implement the IcTopNavigation component with an app icon, search bar, navigation buttons for profile and settings, and navigation items. This example demonstrates a comprehensive setup for a typical application header. ```tsx const alignment = "center"; const useStyles = createUseStyles({ main: { minHeight: "100vh", display: "flex" }, mainContentDiv: { border: "var(--ic-border-width) dashed var(--ic-architectural-400)", padding: "var(--ic-space-md)", flex: 1, }, mainSectionContainer: { display: "flex", flex: 1 }, }); const classes = useStyles(); return ( <>

Example heading

Example sub-heading

Remove this div and add your custom content in IcSectionContainer.

[footerLink] [footerLink] [footerLink] [footerLink] ) ``` -------------------------------- ### Install UI Kit Components Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/get-started/install-components.mdx Install the UI Kit components and fonts using npm. Choose the appropriate command based on whether you are using web components or React. ```shell # Web components, Angular, Vue, Svelte npm install @ukic/web-components @ukic/fonts # React npm install @ukic/react @ukic/fonts ``` -------------------------------- ### Side Navigation with Back to Top Component Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/patterns/side-navigation-layout.mdx This example shows a side navigation setup that includes a back-to-top component. It's useful for long pages where users need to quickly return to the top. ```html

Example heading

Example sub-heading

Remove this div and add your custom content in IcSectionContainer.

[footerLink] [footerLink] [footerLink] [footerLink] [footerLink] ) ``` -------------------------------- ### IcChip Component Examples Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/components/feedback-progress/chips/guidance.mdx Demonstrates the usage of IcChip components with labels and icons. Includes dismissible and static chip examples. ```jsx ``` -------------------------------- ### Top Navigation with Back to Top Example Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/patterns/top-navigation-layout.mdx Combines the IcTopNavigation with IcBackToTop and IcFooter components to create a complete page layout. This example shows how to integrate these components for a full-page structure. ```jsx <>

Example heading

Example sub-heading

Remove this div and add your custom content in IcSectionContainer.

[footerLink] [footerLink] [footerLink] [footerLink] [footerLink] ``` -------------------------------- ### Install Canary Web Components Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/get-started/releases-versioning.mdx Use this command to install the canary web components and associated fonts. This is for testing unstable components. ```shell # Canary Web Components npm i @ukic/canary-web-components @ukic/fonts ``` -------------------------------- ### Web Component Dialog Example Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/components/feedback-progress/dialog/code.mdx Launches a dialog with a checkbox for user agreement. This example includes the HTML structure for the dialog and the associated JavaScript for its functionality. ```html Launch dialog Before continuing, please agree to our terms and conditions. ``` ```css .parent-container { padding: var(--ic-space-md); } ic-checkbox-group { margin-top: var(--ic-space-xs) }
{shortCode}
``` -------------------------------- ### Install React Components with npm Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/get-started/react.mdx Install the React components and fonts packages using npm. Ensure you have a clean package-lock.json if switching from yarn. ```shell # using npm npm install @ukic/react @ukic/fonts ``` ```shell # using yarn rm package-lock.json yarn add @ukic/react @ukic/fonts ``` -------------------------------- ### Install ICDS Packages and Run Codemod Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/get-started/migrating-to-v3.mdx Install the React and Web Components packages, then execute the codemod with a directory and an optional test flag. ```console - npm i @ukic/react - npm i @ukic/web-components - npx @ukic/codemod ``` -------------------------------- ### React Testing Library Test Example Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/get-started/testing-with-jest-and-rtl.mdx This snippet demonstrates a basic test case using React Testing Library to render and interact with a component. It assumes necessary imports and setup are in place. ```javascript import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import Button from "./Button"; describe("Button component", () => { it("renders with default props", () => { render(); expect(screen.getByText("Click me")).toBeInTheDocument(); }); it("calls onClick handler when clicked", async () => { const handleClick = jest.fn(); render(); await userEvent.click(screen.getByText("Click me")); expect(handleClick).toHaveBeenCalledTimes(1); }); }); ``` -------------------------------- ### Basic Search Bar Implementation Source: https://github.com/mi6/ic-design-system/blob/main/src/content/structured/components/inputs/search-bar/guidance.mdx This example demonstrates a basic implementation of the search bar component with a label, options for suggestions, and event handlers for change and submit actions. It also includes a placeholder for user input. ```jsx import { IcSearchBar } from "@ukic/react"; console.log("onIcChange", ev.detail.value)} onIcSubmitSearch={(ev) => console.log("onIcSubmitSearch", ev.detail.value)} placeholder="Start typing to search…" /> ```