Skip to content

Commit

Permalink
Merge pull request #1604 from adevinta/scaffolding-rating-component
Browse files Browse the repository at this point in the history
feat(rating): init package
  • Loading branch information
acd02 authored Oct 26, 2023
2 parents 65db87a + 6f47f2d commit fa8d3b2
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 0 deletions.
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/components/rating/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src
**/*.stories.*
21 changes: 21 additions & 0 deletions packages/components/rating/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Adevinta ASA.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 13 additions & 0 deletions packages/components/rating/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Rating
> @spark-ui/rating
[![storybook](https://img.shields.io/badge/storybook-black?logo=storybook)](https://sparkui.vercel.app/?path=/docs/components-rating--docs)
[![documentation](https://img.shields.io/badge/documentation-black?logo=googledocs)](https://sparkui-adv.vercel.app/docs/components/rating)
[![issue](https://img.shields.io/badge/report%20a%20bug-black?logo=openbugbounty&logoColor=red)](https://github.com/adevinta/spark/issues/new?&projects=4&template=bug-report.yml&assignees=&labels=component,rating)
[![npm](https://img.shields.io/npm/dt/%40spark-ui/rating?logo=npm&labelColor=black)](https://www.npmjs.com/package/@spark-ui/rating)


This package is part of the [`@spark-ui`](https://github.com/adevinta/spark) react-js user interface component library project.

[![Issues open](https://img.shields.io/github/issues-search/adevinta/spark?query=is%3Aopen%20label%3Acomponent%20label%3Arating&logo=openbugbounty&logoColor=red&label=issues%20open&color=red)](https://github.com/adevinta/spark/issues?q=is%3Aopen+label%3Acomponent+label%3Arating)
[![NPM](https://img.shields.io/npm/l/%40spark-ui%2Frating)](https://github.com/adevinta/spark/blob/main/packages/components/rating/LICENSE.md)
48 changes: 48 additions & 0 deletions packages/components/rating/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "@spark-ui/rating",
"version": "0.0.1",
"description": "Ratings let users see and/or set a star rating for a product or other item",
"publishConfig": {
"access": "public"
},
"keywords": [
"@spark-ui",
"react",
"component",
"accessible",
"accessibility",
"wai-aria",
"aria",
"a11y",
"rating"
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "vite build"
},
"devDependencies": {
"@spark-ui/icons": "^1.21.0",
"@spark-ui/icon": "^2.1.0"
},
"peerDependencies": {
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0",
"tailwindcss": "^3.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/adevinta/spark.git",
"directory": "packages/components/rating"
},
"config": {
"title": "rating",
"category": "components"
},
"bugs": {
"url": "https://github.com/adevinta/spark/issues?q=is%3Aopen+label%3Autility+label%3Arating"
},
"homepage": "https://sparkui.vercel.app",
"license": "MIT"
}
33 changes: 33 additions & 0 deletions packages/components/rating/src/Rating.doc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Meta, Canvas } from '@storybook/addon-docs'
import { ArgTypes } from '@storybook/blocks';

import { Rating } from '.'

import * as stories from './Rating.stories'

<Meta of={stories} />

# Rating

Ratings let users see and/or set a star rating for a product or other item.

## Install

```sh
npm install @spark-ui/rating
```

## Import

```tsx
import { Rating } from "@spark-ui/rating"
```

## Props

<ArgTypes of={Rating} />

## Usage

### Default
<Canvas of={stories.Default} />
12 changes: 12 additions & 0 deletions packages/components/rating/src/Rating.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Meta, StoryFn } from '@storybook/react'

import { Rating } from '.'

const meta: Meta<typeof Rating> = {
title: 'Experimental/Rating',
component: Rating,
}

export default meta

export const Default: StoryFn = _args => <Rating />
12 changes: 12 additions & 0 deletions packages/components/rating/src/Rating.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { render, screen } from '@testing-library/react'
import { describe, expect, it } from 'vitest'

import { Rating } from './Rating'

describe('Rating', () => {
it('should render', () => {
render(<Rating />)

expect(screen.getByText(/rating/)).toBeInTheDocument()
})
})
1 change: 1 addition & 0 deletions packages/components/rating/src/Rating.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const Rating = () => <>rating</>
1 change: 1 addition & 0 deletions packages/components/rating/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Rating } from './Rating'
4 changes: 4 additions & 0 deletions packages/components/rating/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../../tsconfig.json",
"include": ["src/**/*", "../../../global.d.ts"]
}
6 changes: 6 additions & 0 deletions packages/components/rating/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import path from 'path'
import { getComponentConfiguration } from '../../../config/index'

const { name } = require(path.resolve(__dirname, 'package.json'))

export default getComponentConfiguration(process.cwd(), name)

0 comments on commit fa8d3b2

Please sign in to comment.