-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Card: Add component stub to test tooling and workflows.
While you might be able to use the component by directly importing it, it will only wrap your content in a `section` html element and not actually provide any styling or functionality. :^)
- Loading branch information
Showing
12 changed files
with
174 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@nordcom/nordstar-card': patch | ||
--- | ||
|
||
Add `<Card/>` component stub to test if the current release workflow is correctly setup. | ||
|
||
While you should be able to actually use the component, it will only wrap your content in a `section` html element. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# @nordcom/nordstar-card | ||
|
||
The description of this component: `<Card/>` is a consistent looking container for content. | ||
|
||
## Installation | ||
|
||
```sh | ||
npm install @nordcom/nordstar-card | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/package.json", | ||
"name": "@nordcom/nordstar-card", | ||
"version": "0.0.1", | ||
"description": "`<Card/>` is a consistent looking container for content.", | ||
"main": "src/index.ts", | ||
"sideEffects": false, | ||
"engines": { | ||
"npm": ">=8", | ||
"node": ">=18 <=21" | ||
}, | ||
"scripts": { | ||
"build": "tsup src --dts", | ||
"build:fast": "tsup src", | ||
"dev": "npm run build:fast -- --watch", | ||
"clean": "rimraf dist .turbo", | ||
"typecheck": "tsc --noEmit", | ||
"prepack": "clean-package", | ||
"postpack": "clean-package restore" | ||
}, | ||
"keywords": [ | ||
"nordstar", | ||
"nordcom", | ||
"component", | ||
"react", | ||
"card", | ||
"nordstar-card" | ||
], | ||
"author": { | ||
"name": "Nordcom Group Inc.", | ||
"email": "[email protected]", | ||
"url": "https://nordcom.io/" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Filiph Siitam Sandström", | ||
"email": "[email protected]", | ||
"url": "https://github.com/filiphsps/" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/NordcomInc/nordstar.git", | ||
"directory": "packages/components/card" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/NordcomInc/nordstar/issues" | ||
}, | ||
"homepage": "https://nordstar.nordcom.io/docs/components/card/", | ||
"files": [ | ||
"dist" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@nordcom/nordstar": "*" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=18" | ||
}, | ||
"devDependencies": { | ||
"clean-package": "2.2.0", | ||
"react": "18.2.0" | ||
}, | ||
"clean-package": "../../../clean-package.config.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { Meta } from '@storybook/react'; | ||
import type { CardProps } from '../src'; | ||
import { Card } from '../src'; | ||
|
||
export default { | ||
title: 'Components/Card', | ||
component: Card, | ||
argTypes: {} | ||
} as Meta<typeof Card>; | ||
|
||
const Template = (args: CardProps) => <Card {...args} />; | ||
|
||
export const Default = { | ||
render: Template, | ||
args: {} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { Card } from '../src'; | ||
import { render } from '@testing-library/react'; | ||
|
||
describe('components', () => { | ||
describe('Card', () => { | ||
it('should render correctly', () => { | ||
const wrapper = render(<Card />); | ||
|
||
expect(() => wrapper.unmount()).not.toThrow(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { HTMLProps, ReactNode } from 'react'; | ||
|
||
export type CardProps = { | ||
children?: ReactNode; | ||
} & HTMLProps<HTMLDivElement>; | ||
|
||
const Card = (props: CardProps) => { | ||
const { children } = props; | ||
|
||
return <section {...props}>{children}</section>; | ||
}; | ||
|
||
export default Card; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Card from './card'; | ||
|
||
export type { CardProps } from './card'; | ||
|
||
export { Card }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig.json", | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"baseUrl": "." | ||
}, | ||
"include": ["src", "index.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig({ | ||
clean: true, | ||
target: 'esnext', | ||
entry: ['src/index.ts', '!src/scripts'], | ||
format: ['cjs', 'esm'] | ||
}); |