-
-
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
21 changed files
with
227 additions
and
26 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": "", | ||
"main": "src/index.ts", | ||
"sideEffects": false, | ||
"engines": { | ||
"npm": ">=8", | ||
"node": ">=18 <=21" | ||
}, | ||
"scripts": { | ||
"build": "tsup --dts", | ||
"build:fast": "tsup", | ||
"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,22 @@ | ||
import { Card } from '../src'; | ||
import type { CardProps } from '../src'; | ||
import type { Meta } from '@storybook/react'; | ||
|
||
const story: Meta<typeof Card> = { | ||
title: 'Components/Card', | ||
component: Card, | ||
argTypes: {} | ||
}; | ||
|
||
const Template = (args: CardProps) => ( | ||
<Card {...args}> | ||
<p>Content inside of the card</p> | ||
</Card> | ||
); | ||
|
||
export const Default = { | ||
render: Template, | ||
args: {} | ||
}; | ||
|
||
export default story; |
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,9 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig.json", | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"baseUrl": "." | ||
}, | ||
"include": ["src/**/*"], | ||
"exclude": ["src/**/*.stories.*", "src/**/*.test.*"] | ||
} |
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 { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig({ | ||
cjsInterop: true, | ||
clean: true, | ||
entry: ['src/index.ts', 'src/**/*.ts(x)?', '!src/**/*.(stories|test).ts(x)?'], | ||
format: ['cjs', 'esm'], | ||
keepNames: true, | ||
skipNodeModulesBundle: true, | ||
sourcemap: true, | ||
target: 'esnext', | ||
tsconfig: 'tsconfig.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
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig({ | ||
cjsInterop: true, | ||
clean: true, | ||
entry: ['src/index.ts', 'src/**/*.ts(x)?', '!src/**/*.(stories|test).ts(x)?'], | ||
format: ['cjs', 'esm'], | ||
keepNames: true, | ||
skipNodeModulesBundle: true, | ||
sourcemap: true, | ||
target: 'esnext', | ||
entry: ['src/index.ts', '!src/scripts'], | ||
format: ['cjs', 'esm'] | ||
tsconfig: 'tsconfig.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
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import type { Meta } from '@storybook/react'; | ||
import type { {{capitalize componentName}}Props } from '../src'; | ||
import { {{capitalize componentName}} } from '../src'; | ||
import type { {{capitalize componentName}}Props } from '../src'; | ||
import type { Meta } from '@storybook/react'; | ||
|
||
export default { | ||
const story: Meta<typeof {{capitalize componentName}}> = { | ||
title: 'Components/{{capitalize componentName}}', | ||
component: {{capitalize componentName}}, | ||
argTypes: {} | ||
} as Meta<typeof {{capitalize componentName}}>; | ||
}; | ||
|
||
const Template = (args: {{capitalize componentName}}Props) => <{{capitalize componentName}} {...args} />; | ||
|
||
export const Default = { | ||
export const Standard = { | ||
render: Template, | ||
args: {} | ||
}; | ||
|
||
export default story; |
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig({ | ||
cjsInterop: true, | ||
clean: true, | ||
entry: ['src/index.ts', 'src/**/*.ts(x)?', '!src/**/*.(stories|test).ts(x)?'], | ||
format: ['cjs', 'esm'], | ||
keepNames: true, | ||
skipNodeModulesBundle: true, | ||
sourcemap: true, | ||
target: 'esnext', | ||
entry: ['src/index.ts', '!src/scripts'], | ||
format: ['cjs', 'esm'] | ||
tsconfig: 'tsconfig.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
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig({ | ||
cjsInterop: true, | ||
clean: true, | ||
entry: ['src/index.ts', 'src/**/*.ts(x)?', '!src/**/*.(stories|test).ts(x)?'], | ||
format: ['cjs', 'esm'], | ||
keepNames: true, | ||
skipNodeModulesBundle: true, | ||
sourcemap: true, | ||
target: 'esnext', | ||
entry: ['src/index.ts', '!src/scripts'], | ||
format: ['cjs', 'esm'] | ||
tsconfig: 'tsconfig.json' | ||
}); |