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

feat(theme): add box-sizing to the global styles (Teams theme) #1057

Merged
merged 20 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### BREAKING CHANGES
- Add `box-sizing: border-box` to all elements, as well as before and after pseudo elements in Teams theme @mnajdova ([#1057](https://github.com/stardust-ui/react/pull/1057))

### Fixes
- Fix overflowing focus outline for `Grid` items for Teams theme @Bugaa92 ([#1195](https://github.com/stardust-ui/react/pull/1195))

Expand Down
1 change: 0 additions & 1 deletion docs/src/prototypes/chatPane/composeMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const getInputWrapperStyles = ({ attached }: ComposeMessageProps): React.CSSProp
const borderWidth = '1px'

return {
boxSizing: 'border-box',
borderStyle: 'solid',
borderWidth,
borderRadius: `${borderTopRadius} ${borderTopRadius} ${borderBottomRadius} ${borderBottomRadius}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ImageProps } from '../../../../components/Image/Image'

export default {
root: ({ props, variables }): ICSSInJSStyle => ({
boxSizing: 'border-box',
display: 'inline-block',
verticalAlign: 'middle',
width: (props.fluid && '100%') || variables.width,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const alertStyles: ComponentSlotStylesInput<AlertProps, AlertVariables> = {
alignItems: 'center',
position: 'relative',
width: '100%',
boxSizing: 'border-box',
borderStyle: v.borderStyle,
borderWidth: v.borderWidth,
borderRadius: v.borderRadius,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ const attachmentStyles: ComponentSlotStylesInput<AttachmentProps, AttachmentVari

outline: 0,

// todo: remove when #1057 to make box-sizing global is checked in
boxSizing: 'border-box',
'& *': {
boxSizing: `border-box`,
},

...(p.isFromKeyboard && {
':focus': {
borderColor: v.focusInnerBorderColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const avatarStyles: ComponentSlotStylesInput<AvatarProps, any> = {
const sizeInRem = pxToRem(sizeToPxValue[size])

return {
boxSizing: 'border-box',
position: 'relative',
backgroundColor: 'inherit',
display: 'inline-block',
Expand All @@ -27,7 +26,6 @@ const avatarStyles: ComponentSlotStylesInput<AvatarProps, any> = {
}
},
image: ({ variables: v }): ICSSInJSStyle => ({
boxSizing: 'border-box',
borderColor: v.avatarBorderColor,
borderStyle: 'solid',
borderWidth: `${v.avatarBorderWidth}px`,
Expand All @@ -40,7 +38,6 @@ const avatarStyles: ComponentSlotStylesInput<AvatarProps, any> = {
label: ({ props: { size } }): ICSSInJSStyle => {
const sizeInRem = pxToRem(sizeToPxValue[size])
return {
boxSizing: 'border-box',
display: 'inline-block',
width: sizeInRem,
height: sizeInRem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const dropdownStyles: ComponentSlotStylesInput<DropdownPropsAndState, DropdownVa
display: 'flex',
flexWrap: 'wrap',
position: 'relative',
boxSizing: 'border-box',
borderStyle: 'solid',
borderColor: 'transparent',
outline: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export default (siteVars): DropdownVariables => ({
borderWidth: `0 0 ${pxToRem(2)} 0`,
color: siteVars.bodyColor,
comboboxPaddingButton: `0 ${_12px_asRem}`,
comboboxFlexBasis: '50px',
comboboxFlexBasis: pxToRem(50),
listBackgroundColor: siteVars.colors.white,
listBorderRadius: _3px_asRem,
listPadding: `${pxToRem(8)} 0`,
listBoxShadow: `0 .2rem .6rem 0 ${siteVars.gray06}`,
listMaxHeight: '20rem',
listMaxHeight: pxToRem(296),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious how 20rem became 296px?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So previously on the Dropdown list, we had padding on the top and 6 elements in the list (one list item has height of 48px) => (6*48px) + 8px = 296px :) We don't want to use rem anyway and the height was a bit different because of the box-sizing, so that is why I converted it to px.

listItemBackgroundColor: siteVars.colors.white,
listItemBackgroundColorActive: siteVars.colors.primary[500],
listItemColorActive: siteVars.colors.white,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const inputStyles: ComponentSlotStylesInput<InputProps, InputVariables> = {

input: ({ props: p, variables: v }): ICSSInJSStyle => ({
outline: 0,
boxSizing: 'border-box',
borderStyle: 'solid',
borderColor: 'transparent',
borderWidth: v.borderWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ const radioStyles: ComponentSlotStylesInput<
RadioGroupItemVariables
> = {
root: ({ props: p, variables: v }): ICSSInJSStyle => ({
// can remove this after global style for border-box goes in
boxSizing: 'border-box',

alignItems: 'center',
borderStyle: 'solid',
borderWidth: `${pxToRem(1)}`,
Expand Down Expand Up @@ -69,10 +66,6 @@ const radioStyles: ComponentSlotStylesInput<
// overrides from icon styles
backgroundColor: 'transparent',
boxShadow: 'none',

// can remove this after global style for border-box goes in
boxSizing: 'border-box',

borderStyle: 'solid',
borderWidth: `${pxToRem(1)}`,
borderColor: 'currentColor',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export const getSizeStyles = (sizeInPx: number, variables: StatusVariables) => {
const statusStyles: ComponentSlotStylesInput<StatusProps, StatusVariables> = {
root: ({ props: { color, size, state }, variables }): ICSSInJSStyle => {
return {
boxSizing: 'border-box',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ const globalStyles: StaticStyleFunction = siteVars => ({
fontSize: siteVars.bodyFontSize,
lineHeight: siteVars.bodyLineHeight,
},
'*': {
boxSizing: 'border-box',
},
'*:before': {
boxSizing: 'border-box',
},
'*:after': {
boxSizing: 'border-box',
},
})

export default globalStyles