Skip to content

Commit

Permalink
Merge pull request #1090 from primer/cb/functional-vars-2
Browse files Browse the repository at this point in the history
Update color variable usage (part 2)
  • Loading branch information
colebemis committed Feb 26, 2021
2 parents 0b81666 + fa106ea commit cf1d4b8
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-islands-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': patch
---

Use functional color variables in BaseStyles
5 changes: 5 additions & 0 deletions .changeset/cuddly-suns-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': patch
---

Use functional color variables in BranchName
5 changes: 5 additions & 0 deletions .changeset/purple-snakes-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': patch
---

Use functional color variables in BorderBox
5 changes: 5 additions & 0 deletions .changeset/warm-dryers-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': patch
---

Use functional color variables in AvatarPair
5 changes: 5 additions & 0 deletions .changeset/wet-dryers-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': patch
---

Use functional color variables in AvatarStack
9 changes: 5 additions & 4 deletions src/AvatarPair.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import React from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import styled from 'styled-components'
import {Relative, RelativeProps} from './Position'
import Avatar from './Avatar'
import {get} from './constants'
import {Relative, RelativeProps} from './Position'
import theme from './theme'

const ChildAvatar = styled(Avatar)`
position: absolute;
right: -15%;
bottom: -9%;
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
box-shadow: ${get('shadows.avatar.childShadow')};
`

export type AvatarPairProps = RelativeProps

const AvatarPair = ({children, ...rest}: AvatarPairProps) => {
const avatars = React.Children.map(children, (child, i) => {
if (!React.isValidElement(child)) return child
return i === 0 ? React.cloneElement(child, {size: 40}) : <ChildAvatar bg="white" {...child.props} size={20} />
return i === 0 ? React.cloneElement(child, {size: 40}) : <ChildAvatar bg="bg.canvas" {...child.props} size={20} />
})
return (
<Relative display="inline-flex" {...rest}>
Expand Down
4 changes: 2 additions & 2 deletions src/AvatarStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const AvatarStackWrapper = styled.span<StyledAvatarStackWrapperProps>`
flex-shrink: 0;
height: 20px;
width: 20px;
box-shadow: 0 0 0 1px ${get('colors.white')};
box-shadow: 0 0 0 1px ${get('colors.bg.canvas')};
margin-left: -11px;
position: relative;
overflow: hidden;
Expand Down Expand Up @@ -120,7 +120,7 @@ const AvatarStackWrapper = styled.span<StyledAvatarStackWrapperProps>`
margin-left: ${get('space.1')};
opacity: 100%;
visibility: visible;
box-shadow: 0 0 0 4px ${get('colors.white')};
box-shadow: 0 0 0 4px ${get('colors.bg.canvas')};
&:first-child {
margin-left: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/BaseStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function BaseStyles(props: BaseStylesProps) {
}

BaseStyles.defaultProps = {
color: 'gray.9',
color: 'text.primary',
fontFamily: 'normal',
lineHeight: 'default',
theme
Expand Down
2 changes: 1 addition & 1 deletion src/BorderBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BorderBox.defaultProps = {
theme,
borderWidth: '1px',
borderStyle: 'solid',
borderColor: 'gray.2',
borderColor: 'border.primary',
borderRadius: 2
}

Expand Down
6 changes: 3 additions & 3 deletions src/BranchName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const BranchName = styled.a<SystemCommonProps & SxProp>`
padding: 2px 6px;
font-size: ${get('fontSizes.0')};
font-family: ${get('fonts.mono')};
color: rgba(27, 31, 35, 0.6);
background-color: #eaf5ff;
border-radius: 3px;
color: ${get('colors.branchName.text')};
background-color: ${get('colors.branchName.bg')};
border-radius: ${get('radii.2')};
${COMMON};
${sx};
`
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/__snapshots__/BranchName.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ exports[`BranchName renders consistently 1`] = `
padding: 2px 6px;
font-size: 12px;
font-family: SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
color: rgba(27,31,35,0.6);
color: #586069;
background-color: #eaf5ff;
border-radius: 3px;
border-radius: 6px;
}
<a
Expand Down

1 comment on commit cf1d4b8

@vercel
Copy link

@vercel vercel bot commented on cf1d4b8 Feb 26, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.