playbook_ui 14.17.0.pre.alpha.PLAY1967bracketlayoutphase27221 → 14.17.0.pre.alpha.PLAY1967bracketlayoutphase27240
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_background/_background.scss +26 -0
- data/app/pb_kits/playbook/pb_background/_background.tsx +5 -3
- data/app/pb_kits/playbook/pb_background/background.test.js +5 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +35 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_layout/_layout.scss +20 -2
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +27 -2
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +4 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +14 -6
- data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +7 -6
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +21 -4
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/table.rb +13 -1
- data/app/pb_kits/playbook/pb_table/table_header.rb +13 -1
- data/dist/chunks/{_typeahead-DZZ1n1Oe.js → _typeahead-BY6AFq1l.js} +1 -1
- data/dist/chunks/{_weekday_stacked-C-B5y5yN.js → _weekday_stacked-CQqRUTO3.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfba70a073b0d33aacdfbea9a358801e6db55becf21f92a4d349bb09c93c8f01
|
4
|
+
data.tar.gz: 56d5e22414e5b0f7f5d4f7d0c0ac959011769c77c9c80825d0640a93f998128c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1167069b006efc96683510cab2ffec8b5428c7e608feb864bc85d17a530dcdf8d41e7d9d6bf618bd58fc4746b948bd477af372082fad188da6464d62f771c91f
|
7
|
+
data.tar.gz: d08485abd673a09f6c0d410b4617aaf65abc44d6bf8780af2e3d0121285bdebb8770ef434c092cb7d43dfc100bd1a6fdbf54128776e813246e9a9b61bb8b3677
|
@@ -55,4 +55,30 @@ $background_colors: map-merge($additional_colors, $merge_kits7);
|
|
55
55
|
transition: 700ms ease-in;
|
56
56
|
}
|
57
57
|
}
|
58
|
+
|
59
|
+
&[class*=imageoverlay] {
|
60
|
+
position: relative;
|
61
|
+
|
62
|
+
&:before {
|
63
|
+
content: "";
|
64
|
+
position: absolute;
|
65
|
+
top: 0;
|
66
|
+
left: 0;
|
67
|
+
right: 0;
|
68
|
+
bottom: 0;
|
69
|
+
z-index: 1;
|
70
|
+
background-color: inherit;
|
71
|
+
}
|
72
|
+
|
73
|
+
* {
|
74
|
+
position: relative;
|
75
|
+
z-index: 2;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
@each $key, $value in $opacity {
|
80
|
+
&.imageoverlay_#{$key}::before {
|
81
|
+
opacity: $value;
|
82
|
+
}
|
83
|
+
}
|
58
84
|
}
|
@@ -25,6 +25,7 @@ type BackgroundProps = {
|
|
25
25
|
backgroundPosition?: ResponsiveProp<string> | string,
|
26
26
|
backgroundRepeat?: ResponsiveProp<BackgroundRepeat> | BackgroundRepeat,
|
27
27
|
imageUrl?: ResponsiveProp<string> | string,
|
28
|
+
imageOverlay?: 'opacity_1' | 'opacity_2' | 'opacity_3' | 'opacity_4' | 'opacity_5' | 'opacity_6' | 'opacity_7' | 'opacity_8' | 'opacity_9' | 'opacity_10',
|
28
29
|
children?: React.ReactChild[] | React.ReactNode,
|
29
30
|
className?: string,
|
30
31
|
customColor?: string,
|
@@ -83,11 +84,12 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
83
84
|
data = {},
|
84
85
|
htmlOptions = {},
|
85
86
|
id,
|
87
|
+
imageOverlay,
|
86
88
|
imageUrl = '',
|
87
89
|
tag = 'div',
|
88
90
|
transition = '',
|
89
91
|
} = props
|
90
|
-
|
92
|
+
|
91
93
|
const [responsiveProps, setResponsiveProps] = useState({
|
92
94
|
backgroundSize: getResponsiveValue(backgroundSize),
|
93
95
|
backgroundPosition: getResponsiveValue(backgroundPosition),
|
@@ -132,6 +134,7 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
132
134
|
[`pb_background_color_${resBackgroundColor}`]: resBackgroundColor && !customColor,
|
133
135
|
[`pb_background_custom_color`]: !!customColor,
|
134
136
|
},
|
137
|
+
imageOverlay ? `imageoverlay_${imageOverlay}` : "",
|
135
138
|
className
|
136
139
|
);
|
137
140
|
|
@@ -155,7 +158,7 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
155
158
|
const ariaProps = buildAriaProps(aria);
|
156
159
|
const dataProps = buildDataProps(data);
|
157
160
|
const htmlProps = buildHtmlProps(htmlOptions);
|
158
|
-
|
161
|
+
|
159
162
|
return (
|
160
163
|
<Tag
|
161
164
|
{...ariaProps}
|
@@ -168,7 +171,6 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
168
171
|
>
|
169
172
|
{children}
|
170
173
|
</Tag>
|
171
|
-
|
172
174
|
)
|
173
175
|
}
|
174
176
|
|
@@ -37,3 +37,8 @@ test('backgroundSize = auto', () => {
|
|
37
37
|
const kit = renderKit(Background, props, { classname: "background-image", imageUrl: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", backgroundSize: 'auto' })
|
38
38
|
expect(kit).toHaveStyle('background-size: auto')
|
39
39
|
})
|
40
|
+
|
41
|
+
test('applies correct overlay class when imageOverlay prop is provided', () => {
|
42
|
+
const kit = renderKit(Background, props, { imageOverlay: 'opacity_6' });
|
43
|
+
expect(kit).toHaveClass('imageoverlay_opacity_6');
|
44
|
+
});
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import Background from "../../pb_background/_background"
|
3
|
+
import Flex from "../../pb_flex/_flex"
|
4
|
+
import FlexItem from "../../pb_flex/_flex_item"
|
5
|
+
import Title from "../../pb_title/_title"
|
6
|
+
|
7
|
+
const BackgroundOverlay = (props) => {
|
8
|
+
return (
|
9
|
+
<Background
|
10
|
+
alt="colorful background"
|
11
|
+
backgroundColor="category_21"
|
12
|
+
className="background lazyload"
|
13
|
+
imageOverlay="opacity_2"
|
14
|
+
imageUrl="https://unsplash.it/500/400/?image=633"
|
15
|
+
{...props}
|
16
|
+
>
|
17
|
+
<Flex
|
18
|
+
orientation="column"
|
19
|
+
vertical="center"
|
20
|
+
{...props}
|
21
|
+
>
|
22
|
+
<FlexItem>
|
23
|
+
<Title
|
24
|
+
dark
|
25
|
+
padding="lg"
|
26
|
+
size={1}
|
27
|
+
text="Background Kit Image"
|
28
|
+
/>
|
29
|
+
</FlexItem>
|
30
|
+
</Flex>
|
31
|
+
</Background>
|
32
|
+
)
|
33
|
+
}
|
34
|
+
|
35
|
+
export default BackgroundOverlay
|
@@ -0,0 +1 @@
|
|
1
|
+
An overlay can be added to the background image by setting the `imageOverlay` prop and adding a `backgroundColor`. The `imageOverlay` prop can be set to any opacity ranging from `opacity_1` to `opacity_10`.
|
@@ -6,3 +6,4 @@ export { default as BackgroundStatus } from './_background_status.jsx'
|
|
6
6
|
export { default as BackgroundStatusSubtle } from './_background_status_subtle.jsx'
|
7
7
|
export { default as BackgroundCategory } from './_background_category.jsx'
|
8
8
|
export { default as BackgroundSize } from './_background_size.jsx'
|
9
|
+
export { default as BackgroundOverlay } from './_background_overlay.jsx'
|
@@ -233,14 +233,16 @@ $bracket-border-width: 4px;
|
|
233
233
|
}
|
234
234
|
|
235
235
|
.layout_tbd {
|
236
|
-
height:
|
236
|
+
height: 140px;
|
237
237
|
display: flex;
|
238
238
|
flex-direction: column;
|
239
239
|
justify-content: center;
|
240
240
|
}
|
241
241
|
|
242
242
|
.layout_participant_winner,
|
243
|
-
.layout_participant_self
|
243
|
+
.layout_participant_self,
|
244
|
+
.layout_participant_winner_self,
|
245
|
+
.layout_participant_winner_self_last {
|
244
246
|
position: relative;
|
245
247
|
|
246
248
|
&::after {
|
@@ -262,6 +264,22 @@ $bracket-border-width: 4px;
|
|
262
264
|
background: $category_1;
|
263
265
|
}
|
264
266
|
|
267
|
+
.layout_participant_winner_self::after {
|
268
|
+
right: 0;
|
269
|
+
background: $product_6_highlight;
|
270
|
+
}
|
271
|
+
|
272
|
+
.layout_participant_winner_self_last::after {
|
273
|
+
left: 0;
|
274
|
+
background: $category_1;
|
275
|
+
}
|
276
|
+
|
277
|
+
.game_separator {
|
278
|
+
&::before, &::after {
|
279
|
+
height: 2px;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
265
283
|
@media (max-width: $screen-md-max) {
|
266
284
|
flex-direction: column;
|
267
285
|
.layout_round_label {
|
@@ -177,13 +177,38 @@ const Layout = (props: LayoutPropTypes) => {
|
|
177
177
|
(child: React.ReactElement & {type: {displayName: string}}) => child.type?.displayName !== 'Side'
|
178
178
|
)
|
179
179
|
|
180
|
-
const numberOfRounds = Array.isArray(
|
180
|
+
const numberOfRounds = Array.isArray(children) ? React.Children.toArray(children).filter(
|
181
181
|
(child) => {
|
182
182
|
return (child as React.ReactElement).type === Layout.Round;
|
183
183
|
}
|
184
184
|
).length : 0
|
185
|
+
|
186
|
+
const lastRoundWithSelf = React.Children.toArray(children).filter((child) => {
|
187
|
+
if ((child as React.ReactElement).type !== Layout.Round) {
|
188
|
+
return false
|
189
|
+
}
|
190
|
+
|
191
|
+
const roundElement = child as React.ReactElement
|
192
|
+
|
193
|
+
const gameChildren = React.Children.toArray(roundElement.props.children)
|
194
|
+
|
195
|
+
const hasWinningSelfParticipant = gameChildren.some((gameChild) => {
|
196
|
+
const gameElement = gameChild as React.ReactElement
|
197
|
+
|
198
|
+
const participantChildren = React.Children.toArray(gameElement.props.children)
|
199
|
+
|
200
|
+
return participantChildren.some((participantChild) => {
|
201
|
+
const participantElement = participantChild as React.ReactElement
|
202
|
+
const { self } = participantElement.props
|
203
|
+
return self === true
|
204
|
+
})
|
205
|
+
})
|
206
|
+
|
207
|
+
return hasWinningSelfParticipant
|
208
|
+
}).length
|
209
|
+
|
185
210
|
const bracketChildren = nonSideChildren.map(child =>
|
186
|
-
React.isValidElement(child) ? React.cloneElement(child, { numberOfRounds }) : child
|
211
|
+
React.isValidElement(child) ? React.cloneElement(child, { numberOfRounds, lastRoundWithSelf }) : child
|
187
212
|
)
|
188
213
|
|
189
214
|
const filteredProps = {...props}
|
@@ -121,6 +121,7 @@ const LayoutBracket = () => {
|
|
121
121
|
name={teamData.eagles.name}
|
122
122
|
points="22"
|
123
123
|
rank={teamData.eagles.rank}
|
124
|
+
self
|
124
125
|
territory={teamData.eagles.territory}
|
125
126
|
winner
|
126
127
|
/>
|
@@ -263,6 +264,7 @@ const LayoutBracket = () => {
|
|
263
264
|
name={teamData.eagles.name}
|
264
265
|
points="28"
|
265
266
|
rank={teamData.eagles.rank}
|
267
|
+
self
|
266
268
|
territory={teamData.eagles.territory}
|
267
269
|
winner
|
268
270
|
/>
|
@@ -337,6 +339,7 @@ const LayoutBracket = () => {
|
|
337
339
|
name={teamData.eagles.name}
|
338
340
|
points="55"
|
339
341
|
rank={teamData.eagles.rank}
|
342
|
+
self
|
340
343
|
territory={teamData.eagles.territory}
|
341
344
|
winner
|
342
345
|
/>
|
@@ -379,6 +382,7 @@ const LayoutBracket = () => {
|
|
379
382
|
rank={teamData.eagles.rank}
|
380
383
|
self
|
381
384
|
territory={teamData.eagles.territory}
|
385
|
+
winner
|
382
386
|
/>
|
383
387
|
</Layout.Game>
|
384
388
|
</Layout.Round>
|
@@ -13,12 +13,13 @@ type LayoutGameProps = {
|
|
13
13
|
className?: string,
|
14
14
|
numberOfRounds: number,
|
15
15
|
numberOfGames: number,
|
16
|
+
lastRoundWithSelf?: number,
|
16
17
|
isOdd: boolean,
|
17
18
|
} & GlobalProps
|
18
19
|
|
19
20
|
// Game component (modeled after Item)
|
20
21
|
const Game = (props: LayoutGameProps) => {
|
21
|
-
const { children, className, numberOfRounds, numberOfGames, isOdd } = props
|
22
|
+
const { children, className, numberOfRounds, numberOfGames, isOdd, lastRoundWithSelf } = props
|
22
23
|
const dynamicInlineProps = globalInlineProps(props)
|
23
24
|
|
24
25
|
const numberOfChildren = Array.isArray(children) ? children.length : 0
|
@@ -27,14 +28,21 @@ const Game = (props: LayoutGameProps) => {
|
|
27
28
|
|
28
29
|
let ratio = 0
|
29
30
|
let exponent
|
31
|
+
let currentRound = numberOfRounds
|
30
32
|
if (numberOfGames > 1) {
|
31
33
|
exponent = (numberOfRounds) - Math.log2(numberOfGames) - 1
|
32
34
|
ratio = 2 ** exponent
|
35
|
+
|
36
|
+
currentRound = exponent + 1
|
33
37
|
}
|
34
38
|
|
35
39
|
let hasWinner = false
|
40
|
+
const hasLastWinnerAndSelf = lastRoundWithSelf === currentRound
|
36
41
|
if (numberOfChildren === 2) {
|
37
|
-
const [
|
42
|
+
const [firstChildWithoutProps, secondChildWithoutProps] = React.Children.toArray(children)
|
43
|
+
|
44
|
+
const firstChild = React.cloneElement(firstChildWithoutProps, { hasLastWinnerAndSelf })
|
45
|
+
const secondChild = React.cloneElement(secondChildWithoutProps, { hasLastWinnerAndSelf })
|
38
46
|
|
39
47
|
if (React.isValidElement(firstChild) && React.isValidElement(secondChild)) {
|
40
48
|
if ('winner' in firstChild.props || 'winner' in secondChild.props) {
|
@@ -52,7 +60,7 @@ const Game = (props: LayoutGameProps) => {
|
|
52
60
|
shadow="deep"
|
53
61
|
>
|
54
62
|
<Card.Body padding="none">{firstChild}</Card.Body>
|
55
|
-
<SectionSeparator />
|
63
|
+
<SectionSeparator className="game_separator"/>
|
56
64
|
<Card.Body padding="none">{secondChild}</Card.Body>
|
57
65
|
</Card>
|
58
66
|
{isOdd && numberOfGames > 1 &&
|
@@ -84,13 +92,13 @@ const Game = (props: LayoutGameProps) => {
|
|
84
92
|
shadow="deep"
|
85
93
|
>
|
86
94
|
<Card.Body padding="xs">
|
87
|
-
<Body color="
|
95
|
+
<Body color="light">
|
88
96
|
To be determined...
|
89
97
|
</Body>
|
90
98
|
</Card.Body>
|
91
|
-
<SectionSeparator />
|
99
|
+
<SectionSeparator className="game_separator"/>
|
92
100
|
<Card.Body padding="xs">
|
93
|
-
<Body color="
|
101
|
+
<Body color="light">
|
94
102
|
To be determined...
|
95
103
|
</Body>
|
96
104
|
</Card.Body>
|
@@ -23,9 +23,10 @@ type LayoutParticipantProps = {
|
|
23
23
|
} & GlobalProps
|
24
24
|
|
25
25
|
export const Participant = (props: LayoutParticipantProps) => {
|
26
|
-
const { className, name = 'To be determined...', territory = '', points, rank, avatar, winner, self } = props
|
26
|
+
const { className, name = 'To be determined...', territory = '', points, rank, avatar, winner, self, hasLastWinnerAndSelf } = props
|
27
27
|
const dynamicInlineProps = globalInlineProps(props)
|
28
|
-
const
|
28
|
+
const isLastWinnerAndSelf = hasLastWinnerAndSelf && self && winner
|
29
|
+
const classes = classnames(buildCss('layout_participant', winner ? 'winner' : '', self ? 'self' : '', isLastWinnerAndSelf ? 'last' : ''), globalProps(props), className)
|
29
30
|
return (
|
30
31
|
<Background
|
31
32
|
backgroundColor={winner ? "success_subtle" : "white"}
|
@@ -42,15 +43,15 @@ export const Participant = (props: LayoutParticipantProps) => {
|
|
42
43
|
/>
|
43
44
|
<Body flexGrow={1}>
|
44
45
|
<Flex justify="between">
|
45
|
-
<Body color={winner ? "success" : "default"}>{winner ? <strong>{name}</strong> : name
|
46
|
+
<Body color={winner && !isLastWinnerAndSelf ? "success" : "default"}>{winner ? <strong>{name}{self ? ' (You)' : ''}</strong> : name + (self && !isLastWinnerAndSelf ? ' (You)' : '')}</Body>
|
46
47
|
<Body
|
47
|
-
color={winner ? "success" : "light"}
|
48
|
+
color={winner && !isLastWinnerAndSelf ? "success" : "light"}
|
48
49
|
display="flex"
|
49
50
|
>
|
50
51
|
{points && (<>
|
51
52
|
<strong>{points}</strong>
|
52
53
|
<Detail
|
53
|
-
color={winner ? "success" : "light"}
|
54
|
+
color={winner && !isLastWinnerAndSelf ? "success" : "light"}
|
54
55
|
text="pts"
|
55
56
|
/>
|
56
57
|
</>)}
|
@@ -61,7 +62,7 @@ export const Participant = (props: LayoutParticipantProps) => {
|
|
61
62
|
|
62
63
|
<Badge
|
63
64
|
text={rank}
|
64
|
-
variant={winner ? "success" : self ? "notification" : "neutral"}
|
65
|
+
variant={winner && !isLastWinnerAndSelf ? "success" : self ? "notification" : "neutral"}
|
65
66
|
/>
|
66
67
|
</Body>
|
67
68
|
</Body>
|
@@ -25,16 +25,33 @@ type LayoutRoundProps = {
|
|
25
25
|
children: React.ReactNode[] | React.ReactNode,
|
26
26
|
className?: string,
|
27
27
|
numberOfRounds: number,
|
28
|
+
lastRoundWithSelf: number,
|
28
29
|
} & GlobalProps
|
29
30
|
|
30
31
|
export const Round = (props: LayoutRoundProps) => {
|
31
|
-
const { children, className, numberOfRounds } = props
|
32
|
+
const { children, className, numberOfRounds, lastRoundWithSelf } = props
|
32
33
|
const dynamicInlineProps = globalInlineProps(props)
|
33
34
|
const numberOfChildren = Array.isArray(children) ? children.length : 0
|
34
35
|
|
35
|
-
const childrenWithProps = Array.isArray(children)
|
36
|
-
|
37
|
-
|
36
|
+
const childrenWithProps = Array.isArray(children)
|
37
|
+
? children.map((child, index) =>
|
38
|
+
React.isValidElement(child)
|
39
|
+
? React.cloneElement(child, {
|
40
|
+
numberOfRounds,
|
41
|
+
numberOfGames: numberOfChildren,
|
42
|
+
isOdd: index % 2 === 0,
|
43
|
+
key: `child_${index}`,
|
44
|
+
lastRoundWithSelf
|
45
|
+
})
|
46
|
+
: child
|
47
|
+
)
|
48
|
+
: React.isValidElement(children)
|
49
|
+
? React.cloneElement(children, {
|
50
|
+
numberOfRounds,
|
51
|
+
numberOfGames: numberOfChildren,
|
52
|
+
lastRoundWithSelf
|
53
|
+
})
|
54
|
+
: children
|
38
55
|
|
39
56
|
const rightConnectors = Array.from({ length: numberOfChildren / 2 }, (_, index) => (
|
40
57
|
<div
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<%= pb_rails("table", props: { size: "sm", header_style: "borderless" }) do %>
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>Column 1</th>
|
5
|
+
<th>Column 2</th>
|
6
|
+
<th>Column 3</th>
|
7
|
+
<th>Column 4</th>
|
8
|
+
<th>Column 5</th>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<tr>
|
13
|
+
<td>Value 1</td>
|
14
|
+
<td>Value 2</td>
|
15
|
+
<td>Value 3</td>
|
16
|
+
<td>Value 4</td>
|
17
|
+
<td>Value 5</td>
|
18
|
+
</tr>
|
19
|
+
<tr>
|
20
|
+
<td>Value 1</td>
|
21
|
+
<td>Value 2</td>
|
22
|
+
<td>Value 3</td>
|
23
|
+
<td>Value 4</td>
|
24
|
+
<td>Value 5</td>
|
25
|
+
</tr>
|
26
|
+
<tr>
|
27
|
+
<td>Value 1</td>
|
28
|
+
<td>Value 2</td>
|
29
|
+
<td>Value 3</td>
|
30
|
+
<td>Value 4</td>
|
31
|
+
<td>Value 5</td>
|
32
|
+
</tr>
|
33
|
+
</tbody>
|
34
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Customize your header by removing the header borders with the `header_style: "borderless"` prop.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%= pb_rails("card", props: { background: "light" }) do %>
|
2
|
+
<%= pb_rails("table", props: { size: "sm", header_style: "floating" }) do %>
|
3
|
+
<%= pb_rails("table/table_head") do %>
|
4
|
+
<%= pb_rails("background", props: { background_color: "light", tag: "tr" }) do %>
|
5
|
+
<%= pb_rails("table/table_header", props: { text: "Column 1"}) %>
|
6
|
+
<%= pb_rails("table/table_header", props: { text: "Column 2"}) %>
|
7
|
+
<%= pb_rails("table/table_header", props: { text: "Column 3"}) %>
|
8
|
+
<%= pb_rails("table/table_header", props: { text: "Column 4"}) %>
|
9
|
+
<%= pb_rails("table/table_header", props: { text: "Column 5"}) %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<%= pb_rails("table/table_body") do %>
|
13
|
+
<%= pb_rails("table/table_row") do %>
|
14
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
15
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
16
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
17
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
18
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
19
|
+
<% end %>
|
20
|
+
<%= pb_rails("table/table_row") do %>
|
21
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
22
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
23
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
24
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
25
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
26
|
+
<% end %>
|
27
|
+
<%= pb_rails("table/table_row") do %>
|
28
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
29
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
30
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
31
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
32
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Further customize your header by using the [table with background kit](https://playbook.powerapp.cloud/kits/table/rails#table-with-background-kit) logic to give your table header a custom background color. Use the `header_style: "floating"` prop to visually nest the borderless table within a card or collapsible with a matching background color (the `background_color` passed to Background kit should match the `background` or `background_color` for the element in which it is nested).
|
@@ -1 +1 @@
|
|
1
|
-
Further customize your header by using the [table with background kit](https://playbook.powerapp.cloud/kits/table/react#table-with-background-kit) logic to give your table header a custom background color. Use the `headerStyle="floating"` prop to visually nest the borderless table within a card or collapsible with a matching background color (the `backgroundColor` passed to Background kit should match the `backgroundColor` for the element in which it is nested).
|
1
|
+
Further customize your header by using the [table with background kit](https://playbook.powerapp.cloud/kits/table/react#table-with-background-kit) logic to give your table header a custom background color. Use the `headerStyle="floating"` prop to visually nest the borderless table within a card or collapsible with a matching background color (the `backgroundColor` passed to Background kit should match the `background` or `backgroundColor` for the element in which it is nested).
|
@@ -37,6 +37,8 @@ examples:
|
|
37
37
|
- table_with_collapsible_with_nested_table_rails: Table with Collapsible with Nested Table
|
38
38
|
- table_with_clickable_rows: Table with Clickable Rows
|
39
39
|
- table_with_selectable_rows: Table with Selectable Rows
|
40
|
+
- table_with_header_style_borderless: Header Style Borderless
|
41
|
+
- table_with_header_style_floating: Header Style Floating
|
40
42
|
|
41
43
|
react:
|
42
44
|
- table_sm: Small
|
@@ -37,13 +37,16 @@ module Playbook
|
|
37
37
|
prop :outer_padding, type: Playbook::Props::Enum,
|
38
38
|
values: ["none", "xxs", "xs", "sm", "md", "lg", "xl", nil],
|
39
39
|
default: nil
|
40
|
+
prop :header_style, type: Playbook::Props::Enum,
|
41
|
+
values: %w[default borderless floating],
|
42
|
+
default: "default"
|
40
43
|
|
41
44
|
def classname
|
42
45
|
generate_classname(
|
43
46
|
"pb_table", "table-#{size}", single_line_class, dark_class,
|
44
47
|
disable_hover_class, container_class, data_table_class, sticky_class, sticky_left_column_class,
|
45
48
|
sticky_right_column_class, collapse_class, vertical_border_class, striped_class, outer_padding_class,
|
46
|
-
"table-responsive-#{responsive}", separator: " "
|
49
|
+
"table-responsive-#{responsive}", header_style_class, separator: " "
|
47
50
|
)
|
48
51
|
end
|
49
52
|
|
@@ -123,6 +126,15 @@ module Playbook
|
|
123
126
|
outer_padding.present? ? "outer_padding_#{space_css_name}#{outer_padding}" : nil
|
124
127
|
end
|
125
128
|
end
|
129
|
+
|
130
|
+
def header_style_class
|
131
|
+
case header_style
|
132
|
+
when "borderless"
|
133
|
+
"header-borderless"
|
134
|
+
when "floating"
|
135
|
+
"header-floating"
|
136
|
+
end
|
137
|
+
end
|
126
138
|
end
|
127
139
|
end
|
128
140
|
end
|
@@ -26,9 +26,12 @@ module Playbook
|
|
26
26
|
prop :tag, type: Playbook::Props::Enum,
|
27
27
|
values: %w[table div],
|
28
28
|
default: "table"
|
29
|
+
prop :header_style, type: Playbook::Props::Enum,
|
30
|
+
values: %w[default borderless floating],
|
31
|
+
default: "default"
|
29
32
|
|
30
33
|
def classname
|
31
|
-
generate_classname("pb_table_header_kit", align_class) + tag_class
|
34
|
+
generate_classname("pb_table_header_kit", align_class, header_style_class) + tag_class
|
32
35
|
end
|
33
36
|
|
34
37
|
def tag_class
|
@@ -106,6 +109,15 @@ module Playbook
|
|
106
109
|
end
|
107
110
|
active_item
|
108
111
|
end
|
112
|
+
|
113
|
+
def header_style_class
|
114
|
+
case header_style
|
115
|
+
when "borderless"
|
116
|
+
"header-borderless"
|
117
|
+
when "floating"
|
118
|
+
"header-floating"
|
119
|
+
end
|
120
|
+
end
|
109
121
|
end
|
110
122
|
end
|
111
123
|
end
|