Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update color variable usage (part 2) #1090

Merged
merged 6 commits into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
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