@faststore/ui 2.0.6-alpha.0 → 2.0.7-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.7-alpha.0](https://github.com/vtex/faststore/compare/v2.0.6-alpha.0...v2.0.7-alpha.0) (2022-12-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * Adds `DiscountBadge` component ([#1546](https://github.com/vtex/faststore/issues/1546)) ([9b2e279](https://github.com/vtex/faststore/commit/9b2e27940ffa9b52c9a62541a07e1f593a0bcfb7)), closes [#313](https://github.com/vtex/faststore/issues/313)
12
+
13
+
14
+
6
15
  ## [2.0.6-alpha.0](https://github.com/vtex/faststore/compare/v2.0.5-alpha.0...v2.0.6-alpha.0) (2022-12-08)
7
16
 
8
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/ui",
3
- "version": "2.0.6-alpha.0",
3
+ "version": "2.0.7-alpha.0",
4
4
  "description": "A lightweight, framework agnostic component library for React",
5
5
  "author": "emersonlaurentino",
6
6
  "license": "MIT",
@@ -78,5 +78,5 @@
78
78
  "node": "16.18.0",
79
79
  "yarn": "1.19.1"
80
80
  },
81
- "gitHead": "ee9301dc7f42f9f5f6e8ccb5521078e8601fa728"
81
+ "gitHead": "f740d9f405309548f33c81d061131de9905c95bf"
82
82
  }
@@ -0,0 +1,38 @@
1
+ import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
+
3
+ import { DiscountBadge } from '@faststore/components'
4
+
5
+ <Meta title="Molecules/DiscountBadge" component={DiscountBadge} argTypes={{}} />
6
+
7
+ export const Template = (args) => (
8
+ <DiscountBadge id="discount-badge-id" listPrice={65} spotPrice={40} />
9
+ )
10
+
11
+ <header>
12
+
13
+ # DiscountBadge
14
+
15
+ A custom `Badge` that display product's discounts.
16
+
17
+ </header>
18
+
19
+ ## Usage
20
+
21
+ ```jsx
22
+ import { DiscountBadge } from '@faststore/ui'
23
+ // Styles
24
+ import '@faststore/ui/src/components/molecules/DiscountBadge/styles.scss'
25
+ ```
26
+
27
+ <Canvas>
28
+ <Story
29
+ name="default"
30
+ args={{
31
+ id: 'discount-badge-default',
32
+ }}
33
+ >
34
+ {Template.bind({})}
35
+ </Story>
36
+ </Canvas>
37
+
38
+ <ArgsTable story="default" />
@@ -0,0 +1,57 @@
1
+ [data-fs-discount-badge] {
2
+ // --------------------------------------------------------
3
+ // Design Tokens for Discount Badge
4
+ // --------------------------------------------------------
5
+
6
+ // Low
7
+ --fs-discount-badge-low-bkg-color : var(--fs-badge-success-bkg-color);
8
+ --fs-discount-badge-low-text-color : var(--fs-badge-success-text-color);
9
+ --fs-discount-badge-low-border-color : var(--fs-badge-success-border-color);
10
+
11
+ // Medium
12
+ --fs-discount-badge-medium-bkg-color : var(--fs-badge-warning-bkg-color);
13
+ --fs-discount-badge-medium-text-color : var(--fs-badge-warning-text-color);
14
+ --fs-discount-badge-medium-border-color : var(--fs-badge-warning-border-color);
15
+
16
+ // High
17
+ --fs-discount-badge-high-bkg-color : var(--fs-badge-danger-bkg-color);
18
+ --fs-discount-badge-high-text-color : var(--fs-badge-danger-text-color);
19
+ --fs-discount-badge-high-border-color : var(--fs-badge-danger-border-color);
20
+
21
+ // --------------------------------------------------------
22
+ // Variants Styles
23
+ // --------------------------------------------------------
24
+
25
+ &[data-fs-discount-badge-variant="low"] {
26
+ color: var(--fs-discount-badge-low-text-color);
27
+
28
+ [data-fs-badge-wrapper] {
29
+ background-color: var(--fs-discount-badge-low-bkg-color);
30
+ border-color: var(--fs-discount-badge-low-border-color);
31
+
32
+ &::after {
33
+ background-color: var(--fs-discount-badge-low-bkg-color);
34
+ }
35
+ }
36
+ }
37
+
38
+ &[data-fs-discount-badge-variant="medium"] {
39
+ color: var(--fs-discount-badge-medium-text-color);
40
+
41
+ [data-fs-badge-wrapper] {
42
+ background-color: var(--fs-discount-badge-medium-bkg-color);
43
+ border-color: var(--fs-discount-badge-medium-border-color);
44
+ &::after { background-color: var(--fs-discount-badge-medium-bkg-color); }
45
+ }
46
+ }
47
+
48
+ &[data-fs-discount-badge-variant="high"] {
49
+ color: var(--fs-discount-badge-high-text-color);
50
+
51
+ [data-fs-badge-wrapper] {
52
+ background-color: var(--fs-discount-badge-high-bkg-color);
53
+ border-color: var(--fs-discount-badge-high-border-color);
54
+ &::after { background-color: var(--fs-discount-badge-high-bkg-color); }
55
+ }
56
+ }
57
+ }
@@ -8,6 +8,7 @@
8
8
 
9
9
  // Molecules
10
10
  @import "../components/molecules/CheckboxField/styles";
11
+ @import "../components/molecules/DiscountBadge/styles";
11
12
  @import "../components/molecules/InputField/styles";
12
13
  @import "../components/molecules/RadioField/styles";
13
14
  @import "../components/molecules/Tag/styles";