playbook_ui 14.7.0.pre.rc.5 → 14.7.0.pre.rc.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +2 -1
  3. data/app/pb_kits/playbook/pb_currency/_currency.tsx +16 -6
  4. data/app/pb_kits/playbook/pb_currency/currency.rb +38 -11
  5. data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
  6. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.html.erb +7 -0
  7. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.jsx +18 -0
  8. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.md +3 -0
  9. data/app/pb_kits/playbook/pb_currency/docs/example.yml +3 -1
  10. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  11. data/app/pb_kits/playbook/pb_link/_link.scss +66 -0
  12. data/app/pb_kits/playbook/pb_link/_link.tsx +107 -0
  13. data/app/pb_kits/playbook/pb_link/docs/_link_color.html.erb +30 -0
  14. data/app/pb_kits/playbook/pb_link/docs/_link_color.jsx +40 -0
  15. data/app/pb_kits/playbook/pb_link/docs/_link_disabled.html.erb +5 -0
  16. data/app/pb_kits/playbook/pb_link/docs/_link_disabled.jsx +15 -0
  17. data/app/pb_kits/playbook/pb_link/docs/_link_icon.html.erb +15 -0
  18. data/app/pb_kits/playbook/pb_link/docs/_link_icon.jsx +25 -0
  19. data/app/pb_kits/playbook/pb_link/docs/_link_tag.html.erb +35 -0
  20. data/app/pb_kits/playbook/pb_link/docs/_link_tag.jsx +45 -0
  21. data/app/pb_kits/playbook/pb_link/docs/_link_underline.html.erb +5 -0
  22. data/app/pb_kits/playbook/pb_link/docs/_link_underline.jsx +15 -0
  23. data/app/pb_kits/playbook/pb_link/docs/example.yml +16 -0
  24. data/app/pb_kits/playbook/pb_link/docs/index.js +5 -0
  25. data/app/pb_kits/playbook/pb_link/link.html.erb +21 -0
  26. data/app/pb_kits/playbook/pb_link/link.rb +44 -0
  27. data/app/pb_kits/playbook/pb_link/link.test.jsx +92 -0
  28. data/app/pb_kits/playbook/tokens/_typography.scss +35 -0
  29. data/dist/chunks/_weekday_stacked-BtJy6Bbm.js +45 -0
  30. data/dist/chunks/vendor.js +1 -1
  31. data/dist/menu.yml +3 -0
  32. data/dist/playbook-doc.js +1 -1
  33. data/dist/playbook.css +1 -1
  34. data/lib/playbook/version.rb +1 -1
  35. metadata +23 -3
  36. data/dist/chunks/_weekday_stacked-Dh3OU4s8.js +0 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efb07a700bc1712d465c672663fd3cbe9b73a7fb5a639180c556326962cd8b4a
4
- data.tar.gz: 7b671fd8a7eb6533bcdec5db310e6f8938d48d69b27a6a840e89fe6ec6b851e2
3
+ metadata.gz: '069762b184df16bf1e6ca09b2eb2a1f9e60fb6307d095093ee61c57bfeb16e7b'
4
+ data.tar.gz: dda468d058816dcd550c30c9897b5d27f6e3fced4b45ee852cb836702f421d8f
5
5
  SHA512:
6
- metadata.gz: 3e4172b5ba90e4d8f6dc98b362a160b6c465a96f5c7474430b9a52195918a3741a25e7de9cb61dc37fa7c05d575cc15076f6facc974026fcc103ff63897027c4
7
- data.tar.gz: 2fb4ccc7ea3cec69c24854d4e013d6f3f2c8840e2064b8a248e85b88bc3a51f523426dc16b1b487b5b0fb767a7b7acf9618eb7937f570960f96d7a47c22255af
6
+ metadata.gz: 59ad2e4eba275757df73805824731f8f2a66a8f80b490a1767c77dbf8e7d72a559c373894bfec4e15abfe79c395d03105f777c1050fbb3f7e5b0c649093ee4ad
7
+ data.tar.gz: b7cb4b2bf7945b43851d4cf544df38347a5cb80346fa6f52b2f688938ab5142752f8d87edec3cb2d54a9f3cb7887d067ce6846595bc727c1dff84ac6518529b1
@@ -30,6 +30,7 @@
30
30
  @import 'pb_dialog/dialog';
31
31
  @import 'pb_distribution_bar/distribution_bar';
32
32
  @import 'pb_draggable/draggable';
33
+ @import 'pb_drawer/drawer';
33
34
  @import 'pb_dropdown/dropdown';
34
35
  @import 'pb_file_upload/file_upload';
35
36
  @import 'pb_filter/filter';
@@ -54,6 +55,7 @@
54
55
  @import 'pb_legend/legend';
55
56
  @import 'pb_lightbox/lightbox';
56
57
  @import 'pb_line_graph/line_graph';
58
+ @import 'pb_link/link';
57
59
  @import 'pb_list/list';
58
60
  @import 'pb_loading_inline/loading_inline';
59
61
  @import 'pb_map/map';
@@ -106,7 +108,6 @@
106
108
  @import 'pb_user_badge/user_badge';
107
109
  @import 'pb_walkthrough/walkthrough';
108
110
  @import 'pb_weekday_stacked/weekday_stacked';
109
- @import 'pb_drawer/drawer';
110
111
  @import 'utilities/mixins';
111
112
  @import 'utilities/spacing';
112
113
  @import 'utilities/cursor';
@@ -26,6 +26,7 @@ type CurrencyProps = {
26
26
  variant?: 'default' | 'light' | 'bold',
27
27
  unit?: string,
28
28
  unstyled?: boolean,
29
+ commaSeparator?: boolean,
29
30
  }
30
31
 
31
32
  const sizes: {lg: 1, md: 3, sm: 4} = {
@@ -53,6 +54,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
53
54
  variant = 'default',
54
55
  dark = false,
55
56
  unstyled = false,
57
+ commaSeparator = false,
56
58
  } = props
57
59
 
58
60
  const emphasizedClass = emphasized ? '' : '_deemphasized'
@@ -74,7 +76,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
74
76
  className
75
77
  )
76
78
 
77
- const getFormattedNumber = (input: number | any ) => new Intl.NumberFormat('en-US', {
79
+ const getFormattedNumber = (input: number | any) => new Intl.NumberFormat('en-US', {
78
80
  notation: 'compact',
79
81
  maximumFractionDigits: 1,
80
82
  }).format(input)
@@ -88,12 +90,20 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
88
90
  return isAmount ? num.slice(0, -1) : isUnit ? num.slice(-1) : ''
89
91
  }
90
92
 
91
- const getMatchingDecimalAmount = decimals === "matching" ? amount : whole,
92
- getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
93
+ const getMatchingDecimalAmount = decimals === "matching" ? amount : whole
94
+ const getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
93
95
 
94
- const getAmount = abbreviate ? getAbbreviatedValue('amount') : getMatchingDecimalAmount,
95
- getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null,
96
- getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
96
+ const formatAmount = (amount: string) => {
97
+ if (!commaSeparator) return amount;
98
+
99
+ const [wholePart, decimalPart] = amount.split('.');
100
+ const formattedWhole = new Intl.NumberFormat('en-US').format(parseInt(wholePart));
101
+ return decimalPart ? `${formattedWhole}.${decimalPart}` : formattedWhole;
102
+ }
103
+
104
+ const getAmount = abbreviate ? getAbbreviatedValue('amount') : formatAmount(getMatchingDecimalAmount)
105
+ const getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null
106
+ const getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
97
107
 
98
108
  return (
99
109
  <div
@@ -43,6 +43,9 @@ module Playbook
43
43
  prop :unstyled, type: Playbook::Props::Boolean,
44
44
  default: false
45
45
 
46
+ prop :comma_separator, type: Playbook::Props::Boolean,
47
+ default: false
48
+
46
49
  def classname
47
50
  generate_classname("pb_currency_kit", align, size, dark_class)
48
51
  end
@@ -65,7 +68,7 @@ module Playbook
65
68
  def title_props
66
69
  {
67
70
  size: size_value,
68
- text: abbreviate ? abbreviated_value : whole_value,
71
+ text: abbreviate ? abbreviated_value : formatted_amount,
69
72
  classname: "pb_currency_value",
70
73
  dark: dark,
71
74
  }
@@ -96,28 +99,38 @@ module Playbook
96
99
  private
97
100
 
98
101
  def whole_value
99
- return amount if decimals == "matching"
100
-
101
- amount.split(".").first.to_s
102
+ value = amount.split(".").first
103
+ if comma_separator
104
+ number_with_delimiter(value.gsub(",", ""))
105
+ else
106
+ value
107
+ end
102
108
  end
103
109
 
104
- def abbreviated_value(index = 0..-2)
105
- value = amount.split(".").first.split(",").join("")
106
- abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "").to_s
107
- abbreviated_num[index]
110
+ def decimal_value
111
+ amount.split(".")[1] || "00"
108
112
  end
109
113
 
110
114
  def units_element
111
115
  return "" if decimals == "matching" && !abbreviate && !unit
112
116
 
113
- _, decimal_part = amount.split(".")
114
- if unit.nil? && abbreviate == false
115
- decimal_part.nil? ? ".00" : ".#{decimal_part}"
117
+ if unit.nil? && !abbreviate
118
+ if decimals == "matching"
119
+ ""
120
+ else
121
+ ".#{decimal_value}"
122
+ end
116
123
  else
117
124
  abbreviate ? "#{abbreviated_value(-1)}#{unit}" : unit
118
125
  end
119
126
  end
120
127
 
128
+ def abbreviated_value(index = 0..-2)
129
+ value = amount.split(".").first.gsub(",", "").to_i
130
+ abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "")
131
+ abbreviated_num[index]
132
+ end
133
+
121
134
  def size_value
122
135
  case size
123
136
  when "lg"
@@ -132,6 +145,20 @@ module Playbook
132
145
  def dark_class
133
146
  dark ? "dark" : nil
134
147
  end
148
+
149
+ def formatted_amount
150
+ return abbreviated_value if abbreviate
151
+
152
+ if decimals == "matching"
153
+ if comma_separator
154
+ number_with_delimiter(amount.gsub(",", ""))
155
+ else
156
+ amount
157
+ end
158
+ else
159
+ whole_value
160
+ end
161
+ end
135
162
  end
136
163
  end
137
164
  end
@@ -61,3 +61,38 @@ test('decimals default prop returns decimals as body text', () => {
61
61
  expect(currencyKit.querySelector('.pb_currency_value')).toHaveTextContent('320')
62
62
  expect(currencyKit.querySelector('.unit')).toHaveTextContent('.20')
63
63
  })
64
+
65
+
66
+ test('commaSeparator prop returns comma separated amount', () => {
67
+ render(
68
+ <Currency
69
+ amount="1234567890"
70
+ commaSeparator
71
+ data={{ testid: 'comma-test' }}
72
+ />
73
+ )
74
+ expect(screen.getByTestId('comma-test')).toHaveTextContent('1,234,567,890')
75
+ })
76
+
77
+ test('commaSeparator prop returns comma separated amount with decimals', () => {
78
+ render(
79
+ <Currency
80
+ amount="1234567890.12"
81
+ commaSeparator
82
+ data={{ testid: 'comma-test-decimals' }}
83
+ />
84
+ )
85
+ expect(screen.getByTestId('comma-test-decimals')).toHaveTextContent('1,234,567,890.12')
86
+ })
87
+
88
+ test('commaSeparator prop returns comma separated amount with decimals="matching"', () => {
89
+ render(
90
+ <Currency
91
+ amount="1234567890.12"
92
+ commaSeparator
93
+ data={{ testid: 'comma-test-decimals-matching' }}
94
+ decimals="matching"
95
+ />
96
+ )
97
+ expect(screen.getByTestId('comma-test-decimals-matching')).toHaveTextContent('1,234,567,890.12')
98
+ })
@@ -0,0 +1,7 @@
1
+ <%= pb_rails("currency", props: {
2
+ amount: '1234567.89',
3
+ comma_separator: true,
4
+ size: 'lg',
5
+ emphasized: false,
6
+ decimals: 'matching',
7
+ }) %>
@@ -0,0 +1,18 @@
1
+ import React from "react"
2
+
3
+ import Currency from "../_currency"
4
+
5
+ const CurrencyCommaSeparator = (props) => {
6
+ return (
7
+ <Currency
8
+ amount='1234567.89'
9
+ commaSeparator
10
+ decimals="matching"
11
+ emphasized={false}
12
+ size="lg"
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ export default CurrencyCommaSeparator
@@ -0,0 +1,3 @@
1
+ The optional `commaSeparator` can be used to auto-format the use of commas as a thousands separator.
2
+
3
+ **NOTE:** If the value passed into the `amount` prop is already comma-dilineated, it will not add additional commas.
@@ -8,7 +8,8 @@ examples:
8
8
  - currency_abbreviated: Abbreviate Larger Amounts
9
9
  - currency_matching_decimals: Matching Decimals
10
10
  - currency_unstyled: Unstyled
11
-
11
+ - currency_comma_separator: Comma Separator
12
+
12
13
  react:
13
14
  - currency_variants: Variants
14
15
  - currency_size: Size
@@ -17,6 +18,7 @@ examples:
17
18
  - currency_abbreviated: Abbreviate Larger Amounts
18
19
  - currency_matching_decimals: Matching Decimals
19
20
  - currency_unstyled: Unstyled
21
+ - currency_comma_separator: Comma Separator
20
22
 
21
23
  swift:
22
24
  - currency_size_swift: Size
@@ -5,3 +5,4 @@ export { default as CurrencyNoSymbol } from './_currency_no_symbol.jsx'
5
5
  export { default as CurrencyAbbreviated } from './_currency_abbreviated.jsx'
6
6
  export { default as CurrencyMatchingDecimals } from './_currency_matching_decimals.jsx'
7
7
  export { default as CurrencyUnstyled } from './_currency_unstyled.jsx'
8
+ export { default as CurrencyCommaSeparator } from './_currency_comma_separator.jsx'
@@ -0,0 +1,66 @@
1
+ @import "../tokens/colors";
2
+ @import "../tokens/line_height";
3
+ @import "../tokens/typography";
4
+ @import "../tokens/border_radius";
5
+
6
+ [class^=pb_link_kit]{
7
+ @include pb_link($primary);
8
+ &:hover {
9
+ color: $text_lt_default;
10
+ }
11
+ &:focus {
12
+ outline: none;
13
+ }
14
+ &:focus-visible {
15
+ border-radius: $border_rad_light;
16
+ outline: 1px solid $primary;
17
+ outline-offset: 2px;
18
+ }
19
+ &:visited {
20
+ color: $data_3;
21
+ }
22
+ &.dark {
23
+ @include pb_link($active_dark);
24
+ &:hover {
25
+ color: $text_dk_default;
26
+ }
27
+ }
28
+ @each $color_name, $color_value in $pb_link_colors {
29
+ &[class*=_#{"" + $color_name}] {
30
+ @include pb_link($color_value);
31
+
32
+ &:hover {
33
+ color: map-get($pb_link_hover_colors, $color_name);
34
+ }
35
+
36
+ &:visited {
37
+ color: $data_3;
38
+ }
39
+ }
40
+ }
41
+
42
+ @each $dark_color_name, $dark_color_value in $pb_dark_link_colors{
43
+ &[class*=_#{$dark_color_name}][class*=dark]{
44
+ @include pb_link($dark_color_value);
45
+
46
+ &:hover {
47
+ color: map-get($pb_dark_link_hover_colors, $dark_color_name);
48
+ }
49
+
50
+ &:visited {
51
+ color: $data_3;
52
+ }
53
+ }
54
+ }
55
+
56
+ &[class*=_underline] {
57
+ text-decoration: underline;
58
+ }
59
+
60
+ &[class*=_disabled] {
61
+ pointer-events: none;
62
+ cursor: default;
63
+ color: $text_lt_lighter;
64
+ }
65
+
66
+ }
@@ -0,0 +1,107 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+
4
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
5
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
6
+
7
+ import Icon from '../pb_icon/_icon'
8
+
9
+ type LinkProps = {
10
+ aria?: {[key: string]: string},
11
+ className?: string,
12
+ children?: React.ReactChild[] | React.ReactChild,
13
+ color?: 'default' | 'body' | 'muted' | 'destructive',
14
+ dark?: boolean,
15
+ data?: {[key: string]: string},
16
+ disabled?: boolean,
17
+ href?: string,
18
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void) | ((arg?: Event) => void)},
19
+ icon?: string,
20
+ iconRight?: string,
21
+ id?: string,
22
+ tag?: 'a' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
23
+ text?: string,
24
+ underline?: boolean,
25
+ } & GlobalProps
26
+
27
+ const Link = (props: LinkProps): React.ReactElement => {
28
+ const {
29
+ aria = {},
30
+ children,
31
+ className,
32
+ color = '',
33
+ data = {},
34
+ disabled = false,
35
+ href= '',
36
+ htmlOptions = {},
37
+ icon = '',
38
+ iconRight = '',
39
+ id = '',
40
+ tag = 'a',
41
+ text = '',
42
+ underline = false,
43
+ } = props
44
+
45
+ const ariaProps: {[key: string]: string} = buildAriaProps(aria)
46
+ const dataProps: {[key: string]: string} = buildDataProps(data)
47
+ const htmlProps = buildHtmlProps(htmlOptions);
48
+ const classes = classnames(
49
+ buildCss('pb_link_kit', color, underline ? 'underline' : '', disabled ? 'disabled' : ''),
50
+ globalProps(props),
51
+ className
52
+ )
53
+ const Tag = tag as keyof JSX.IntrinsicElements
54
+
55
+ const renderContent = () => (
56
+ <>
57
+ {icon && (
58
+ <Icon
59
+ fixedWidth
60
+ icon={icon}
61
+ marginRight="xxs"
62
+ size="xs"
63
+ />
64
+ )}
65
+ {text || children}
66
+ {iconRight && (
67
+ <Icon
68
+ fixedWidth
69
+ icon={iconRight}
70
+ marginLeft="xxs"
71
+ size="xs"
72
+ />
73
+ )}
74
+ </>
75
+ )
76
+
77
+ const commonProps = {
78
+ ...ariaProps,
79
+ ...dataProps,
80
+ ...htmlProps,
81
+ className: classes,
82
+ id,
83
+ }
84
+
85
+ if (tag === 'a') {
86
+ return (
87
+ <a
88
+ {...commonProps}
89
+ href={href}
90
+ >
91
+ {renderContent()}
92
+ </a>
93
+ )
94
+ } else {
95
+ return (
96
+ <a
97
+ {...commonProps}
98
+ href={href}
99
+ >
100
+ <Tag>{renderContent()}</Tag>
101
+ </a>
102
+ )
103
+ }
104
+
105
+ }
106
+
107
+ export default Link
@@ -0,0 +1,30 @@
1
+ <div>
2
+ <%= pb_rails("link", props: {
3
+ text: "link example",
4
+ href: "https://www.google.com/search?q=playbook+design+system",
5
+ }) %>
6
+ </div>
7
+
8
+ <div>
9
+ <%= pb_rails("link", props: {
10
+ text: "link example",
11
+ href: "https://www.youtube.com/@PowerHRG",
12
+ color: "body",
13
+ }) %>
14
+ </div>
15
+
16
+ <div>
17
+ <%= pb_rails("link", props: {
18
+ text: "link example",
19
+ href: "https://github.com/powerhome/.github/blob/main/profile/README.md",
20
+ color: "muted",
21
+ }) %>
22
+ </div>
23
+
24
+ <div>
25
+ <%= pb_rails("link", props: {
26
+ text: "link example",
27
+ href: "https://rubygems.org/gems/playbook_ui/",
28
+ color: "destructive",
29
+ }) %>
30
+ </div>
@@ -0,0 +1,40 @@
1
+ import React from 'react'
2
+ import { Link } from 'playbook-ui'
3
+
4
+ const LinkColor = (props) => (
5
+ <div>
6
+ <div>
7
+ <Link
8
+ href="https://www.google.com/search?q=playbook+design+system"
9
+ text="link example"
10
+ {...props}
11
+ />
12
+ </div>
13
+ <div>
14
+ <Link
15
+ color="body"
16
+ href="https://www.youtube.com/@PowerHRG"
17
+ text="link example"
18
+ {...props}
19
+ />
20
+ </div>
21
+ <div>
22
+ <Link
23
+ color="muted"
24
+ href="https://github.com/powerhome/.github/blob/main/profile/README.md"
25
+ text="link example"
26
+ {...props}
27
+ />
28
+ </div>
29
+ <div>
30
+ <Link
31
+ color="destructive"
32
+ href="https://rubygems.org/gems/playbook_ui/"
33
+ text="link example"
34
+ {...props}
35
+ />
36
+ </div>
37
+ </div>
38
+ )
39
+
40
+ export default LinkColor
@@ -0,0 +1,5 @@
1
+ <%= pb_rails("link", props: {
2
+ text: "link example",
3
+ href: "#disabled",
4
+ disabled: true,
5
+ }) %>
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import { Link } from 'playbook-ui'
3
+
4
+ const LinkDisabled = (props) => (
5
+ <div>
6
+ <Link
7
+ disabled
8
+ href="#disabled"
9
+ text="link example"
10
+ {...props}
11
+ />
12
+ </div>
13
+ )
14
+
15
+ export default LinkDisabled
@@ -0,0 +1,15 @@
1
+ <div>
2
+ <%= pb_rails("link", props: {
3
+ text: "link example",
4
+ href: "#icon",
5
+ icon: "arrow-up-right-from-square",
6
+ }) %>
7
+ </div>
8
+
9
+ <div>
10
+ <%= pb_rails("link", props: {
11
+ text: "link example",
12
+ href: "#icon2",
13
+ icon_right: "chevron-right",
14
+ }) %>
15
+ </div>
@@ -0,0 +1,25 @@
1
+ import React from 'react'
2
+ import { Link } from 'playbook-ui'
3
+
4
+ const LinkIcon = (props) => (
5
+ <div>
6
+ <div>
7
+ <Link
8
+ href="#icon"
9
+ icon="arrow-up-right-from-square"
10
+ text="link example"
11
+ {...props}
12
+ />
13
+ </div>
14
+ <div>
15
+ <Link
16
+ href="#icon2"
17
+ iconRight="chevron-right"
18
+ text="link example"
19
+ {...props}
20
+ />
21
+ </div>
22
+ </div>
23
+ )
24
+
25
+ export default LinkIcon
@@ -0,0 +1,35 @@
1
+ <%= pb_rails("link", props: {
2
+ text: "h1 link example",
3
+ href: "#tag",
4
+ icon: "arrow-up-right-from-square",
5
+ tag: "h1",
6
+ }) %>
7
+
8
+ <%= pb_rails("link", props: {
9
+ text: "h3 link example",
10
+ href: "#tag2",
11
+ tag: "h3",
12
+ underline: true,
13
+ }) %>
14
+
15
+ <%= pb_rails("link", props: {
16
+ color: "destructive",
17
+ text: "h6 link example",
18
+ href: "#tag3",
19
+ tag: "h6",
20
+ }) %>
21
+
22
+ <%= pb_rails("link", props: {
23
+ text: "p link example",
24
+ href: "#tag4",
25
+ icon_right: "chevron-right",
26
+ tag: "p",
27
+ }) %>
28
+
29
+ <div>
30
+ This is a <%= pb_rails("link", props: {
31
+ text: "span link example",
32
+ href: "#tag5",
33
+ tag: "span",
34
+ }) %>
35
+ </div>
@@ -0,0 +1,45 @@
1
+ import React from 'react'
2
+ import { Link } from 'playbook-ui'
3
+
4
+ const LinkTag = (props) => (
5
+ <div>
6
+ <Link
7
+ href="#tag"
8
+ icon="arrow-up-right-from-square"
9
+ tag="h1"
10
+ text="h1 link example"
11
+ {...props}
12
+ />
13
+ <Link
14
+ href="#tag2"
15
+ tag="h3"
16
+ text="h3 link example"
17
+ underline
18
+ {...props}
19
+ />
20
+ <Link
21
+ color="destructive"
22
+ href="#tag3"
23
+ tag="h6"
24
+ text="h6 link example"
25
+ {...props}
26
+ />
27
+ <Link
28
+ href="#tag4"
29
+ iconRight="chevron-right"
30
+ tag="p"
31
+ text="p link example"
32
+ {...props}
33
+ />
34
+ <div>
35
+ This is a <Link
36
+ href="#tag5"
37
+ tag="span"
38
+ text="span link example"
39
+ {...props}
40
+ />
41
+ </div>
42
+ </div>
43
+ )
44
+
45
+ export default LinkTag
@@ -0,0 +1,5 @@
1
+ <%= pb_rails("link", props: {
2
+ text: "link example",
3
+ href: "#underline",
4
+ underline: true,
5
+ }) %>