Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit b565213

Browse files
committed
introduced fix to make segment inverted work without specifying color
1 parent 08a2698 commit b565213

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

docs/src/examples/components/Segment/Variations/SegmentExampleInverted.shorthand.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const SegmentExampleInvertedShorthand = () => (
55
<div>
66
<Segment content="Colored segment." color="red" />
77
<br />
8-
<Segment inverted content="Colored inverted segment" color="red" />
8+
<Segment inverted content="Colored inverted segment." color="red" />
99
</div>
1010
)
1111

docs/src/examples/components/Segment/Variations/SegmentExampleInverted.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const SegmentExampleInvertedShorthand = () => (
66
<Segment color="red">Colored segment.</Segment>
77
<br />
88
<Segment inverted color="red">
9-
Colored inverted segment
9+
Colored inverted segment.
1010
</Segment>
1111
</div>
1212
)

src/themes/teams/components/Segment/segmentStyles.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@ import { SegmentVariables } from './segmentVariables'
66

77
const segmentStyles: ComponentSlotStylesInput<SegmentProps, SegmentVariables> = {
88
root: ({ props: p, variables: v }): ICSSInJSStyle => {
9-
const color = _.get(v.colors, p.color, v.color)
9+
const segmentColor = _.get(v.colors, p.color)
1010

1111
return {
1212
padding: v.padding,
13-
background: v.background,
13+
borderTop: `2px solid transparent`,
1414
borderRadius: v.borderRadius,
15-
boxShadow: '0 1px 1px 1px rgba(34,36,38,.15)',
16-
...(color &&
17-
(p.inverted
18-
? {
19-
background: color,
20-
color: '#eee', // TODO: fix this color once we fix #629
21-
}
22-
: {
23-
borderTop: `2px solid ${color}`,
24-
})),
15+
boxShadow: `0 1px 1px 1px ${v.boxShadowColor}`,
16+
color: v.color,
17+
backgroundColor: v.backgroundColor,
18+
borderColor: segmentColor,
19+
...(p.inverted && {
20+
color: v.backgroundColor,
21+
backgroundColor: segmentColor || v.color,
22+
}),
2523
}
2624
},
2725
}

src/themes/teams/components/Segment/segmentVariables.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ import { mapColorsToScheme } from '../../../../lib'
44
export interface SegmentVariables {
55
colors: ColorValues<string>
66
color: string
7-
background: string
7+
backgroundColor: string
88
padding: string
99
borderRadius: string | number
10+
boxShadowColor: string
1011
}
1112

1213
export default (siteVariables): SegmentVariables => {
1314
const colorVariant = 500
1415

1516
return {
1617
colors: mapColorsToScheme(siteVariables, colorVariant),
17-
color: undefined,
18-
background: siteVariables.bodyBackground,
18+
color: siteVariables.black,
19+
backgroundColor: siteVariables.bodyBackground,
1920
padding: '1em',
2021
borderRadius: 0,
22+
boxShadowColor: 'rgba(34,36,38,.15)',
2123
}
2224
}

0 commit comments

Comments
 (0)