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

Commit 16b9fd0

Browse files
bcalverycodepretty
authored andcommitted
fix(attachment): themeing and redline (#1033)
* updates to Attachment Styles * more refinement to attachment * making action icon color match text color * updating Changelog entry for PR * fix file capitalization issue * fix accident put changelog entry in wrong place * updating attachment styles * updating icon in the attachment examples and making it show filled state on hover * updating color for attachment dark theme border and backgroundColor * updating changelog
1 parent 9d746c7 commit 16b9fd0

File tree

13 files changed

+160
-19
lines changed

13 files changed

+160
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2929
- Fix click triggering logic of `Space` and `Enter` keys for `MenuItem` @kuzhelov ([#1175](https://github.com/stardust-ui/react/pull/1175))
3030
- Truncate `content` and `header` of `ListItem` when used from `DropdownSelectedItem` @silviuavram ([#1161](https://github.com/stardust-ui/react/pull/1161))
3131
- Fix `rotate` prop on `Icon` not working in `rtl` @mnajdova ([#1179](https://github.com/stardust-ui/react/pull/1179))
32+
- Updated themeing for `Attachment` for Teams, Teams Dark and Teams Contrast @bcalvery ([#1033]https://github.com/stardust-ui/react/pull/1033)
3233
- `FocusTrapZone` - Do not propagate any keyboard events @sophieH29 ([#1180](https://github.com/stardust-ui/react/pull/1180))
3334
- Capture effect of `Esc` key down event within component for `Popup` and `Dropdown` @kuzhelov ([#1183](https://github.com/stardust-ui/react/pull/1183))
3435

docs/src/examples/components/Attachment/Slots/AttachmentActionExample.shorthand.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,23 @@ class AttachmentActionExampleShorthand extends React.Component {
99
<div>
1010
<Attachment
1111
header="Picture.jpg"
12-
action={{ icon: 'x', onClick: this.handleClick('Remove') }}
12+
action={{
13+
icon: {
14+
name: 'close',
15+
outline: true,
16+
},
17+
onClick: this.handleClick('Remove'),
18+
}}
1319
/>
1420
<Attachment
1521
header="Document.docx"
16-
action={{ icon: 'ellipsis horizontal', onClick: this.handleClick('Show more') }}
22+
action={{
23+
icon: {
24+
name: 'more',
25+
outline: true,
26+
},
27+
onClick: this.handleClick('Show more'),
28+
}}
1729
/>
1830
</div>
1931
)

docs/src/examples/components/Attachment/Types/AttachmentProgressExample.shorthand.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ import { Attachment } from '@stardust-ui/react'
44
const AttachmentProgressExampleShorthand = () => (
55
<Attachment
66
header="Photo.jpg"
7-
action={{ icon: 'x', onClick: () => alert("'X' is clicked!") }}
7+
action={{
8+
icon: {
9+
name: 'close',
10+
outline: true,
11+
},
12+
onClick: () => alert("'X' is clicked!"),
13+
}}
814
progress={33}
915
/>
1016
)

docs/src/examples/components/Attachment/Variations/AttachmentActionableExample.shorthand.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@ import * as React from 'react'
22
import { Attachment } from '@stardust-ui/react'
33

44
class AttachmentActionableExampleShorthand extends React.Component {
5-
handleClick = () => alert('Attachment was clicked')
5+
handleClick = message => e => {
6+
alert(`'${message}' was clicked`)
7+
e.stopPropagation()
8+
}
69

710
render() {
811
return (
912
<Attachment
1013
actionable
11-
icon="file word outline"
14+
icon="table"
1215
header="Document.docx"
1316
description="800 Kb"
14-
action={{ icon: 'x' }}
17+
action={{
18+
icon: {
19+
name: 'more',
20+
outline: true,
21+
},
22+
onClick: this.handleClick('More Action'),
23+
}}
1524
progress={33}
16-
onClick={this.handleClick}
25+
onClick={this.handleClick('Attachment')}
1726
/>
1827
)
1928
}

packages/react/src/themes/teams-dark/componentVariables.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export { default as Attachment } from './components/Attachment/attachmentVariables'
12
export { default as Button } from './components/Button/buttonVariables'
23
export { default as Chat } from './components/Chat/chatVariables'
34
export { default as ChatMessage } from './components/Chat/chatMessageVariables'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { AttachmentVariables } from '../../../teams/components/Attachment/attachmentVariables'
2+
3+
export default (siteVariables: any): Partial<AttachmentVariables> => ({
4+
textColor: siteVariables.colors.grey[50],
5+
textColorHover: siteVariables.colors.grey[50],
6+
7+
backgroundColor: siteVariables.gray600,
8+
borderColor: siteVariables.gray850,
9+
boxShadow: siteVariables.shadowLevel1,
10+
})

packages/react/src/themes/teams-dark/siteVariables.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export const gray08 = '#484644' // light theme gray02
1313
export const gray09 = '#3b3a39' // no mapping color
1414
export const gray10 = '#323130' // no mapping color
1515
export const gray14 = '#292828' // no mapping color
16+
export const gray850 = '#1b1a1a'
17+
export const gray600 = '#323131'
1618

1719
export const brand = '#6264A7' // light theme brand - primary[500]
1820
export const brand02 = '#e2e2f6' // light theme brand14 - primary[100]
@@ -30,6 +32,11 @@ export const red = '#d74654' // no mapping color
3032
export const red08 = '#4f232b' // no mapping color
3133
export const green04 = naturalColors.lightGreen[900]
3234

35+
//
36+
// SHADOW LEVELS
37+
//
38+
export const shadowLevel1 = '0 .2rem .4rem -.075rem rgba(0, 0, 0, .25)'
39+
3340
//
3441
// SEMANTIC ASSIGNMENTS
3542
//
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export { default as Attachment } from './components/Attachment/attachmentStyles'
12
export { default as MenuItem } from './components/Menu/menuItemStyles'

packages/react/src/themes/teams-high-contrast/componentVariables.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export { default as Attachment } from './components/Attachment/attachmentVariables'
12
export { default as Avatar } from './components/Avatar/avatarVariables'
23
export { default as Button } from './components/Button/buttonVariables'
34
export { default as Chat } from './components/Chat/chatVariables'
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { ComponentSlotStylesInput, ICSSInJSStyle } from '../../../types'
2+
import { AttachmentProps } from '../../../../components/Attachment/Attachment'
3+
import { AttachmentVariables } from '../../../teams/components/Attachment/attachmentVariables'
4+
import Button from '../../../../components/Button/Button'
5+
import Icon from '../../../../components/Icon/Icon'
6+
7+
const attachmentStyles: ComponentSlotStylesInput<AttachmentProps, AttachmentVariables> = {
8+
root: ({ props: p, variables: v }): ICSSInJSStyle => ({
9+
...((p.actionable || p.onClick) && {
10+
...(p.isFromKeyboard && {
11+
':focus': {
12+
backgroundColor: v.backgroundColorHover,
13+
color: v.textColorHover,
14+
15+
[`& .${Button.className}`]: {
16+
color: v.textColorHover,
17+
},
18+
19+
[`& .${Icon.className}`]: {
20+
color: v.textColorHover,
21+
},
22+
},
23+
}),
24+
25+
':hover': {
26+
[`& .${Button.className}`]: {
27+
color: v.textColorHover,
28+
},
29+
30+
[`& .${Icon.className}`]: {
31+
color: v.textColorHover,
32+
},
33+
},
34+
}),
35+
}),
36+
37+
action: ({ variables: v }): ICSSInJSStyle => ({
38+
':hover': {
39+
outline: `1px solid ${v.textColorHover}`,
40+
},
41+
}),
42+
}
43+
44+
export default attachmentStyles

0 commit comments

Comments
 (0)