### 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
IngredientsMethodHistoryDrinksRecipesTab One - IngredientsTab Two - MethodTab Three - HistoryTab Four - DrinksTab 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