Skip to content

Commit 2519677

Browse files
committed
Change label design to a more traditional github-like style
1 parent 9e99b67 commit 2519677

5 files changed

Lines changed: 78 additions & 194 deletions

File tree

packages/components/src/components/cards/BaseCard.tsx

Lines changed: 46 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
smallerTextSize,
1515
smallTextSize,
1616
} from '../../styles/variables'
17+
import { fixColorHexWithoutHash } from '../../utils/helpers/colors'
1718
import { stripEmojis } from '../../utils/helpers/github/emojis'
1819
import { vibrateHapticFeedback } from '../../utils/helpers/shared'
1920
import { KeyboardKeyIsPressed } from '../AppKeyboardShortcuts'
@@ -557,64 +558,53 @@ export const BaseCard = React.memo((props: BaseCardProps) => {
557558
>
558559
{labels.map((label, index) => (
559560
<Fragment key={`${label.name}-${label.color}`}>
560-
<Label
561-
backgroundThemeColor={backgroundThemeColor}
562-
colorThemeColor={label.color}
563-
disableEmojis
564-
hideText={false}
565-
outline={false}
566-
small
567-
textThemeColor="foregroundColorMuted65"
568-
transparent
569-
tryFixingColorHexWithoutHash
561+
<Link
562+
TouchableComponent={GestureHandlerTouchableOpacity}
563+
enableUnderlineHover={false}
564+
href="javascript:void(0)"
565+
openOnNewTab={false}
566+
onPress={
567+
!columnId
568+
? undefined
569+
: (() => {
570+
return () => {
571+
vibrateHapticFeedback()
572+
573+
const removeIfAlreadySet = !(
574+
KeyboardKeyIsPressed.meta ||
575+
KeyboardKeyIsPressed.shift
576+
)
577+
578+
const removeOthers = !(
579+
KeyboardKeyIsPressed.alt ||
580+
KeyboardKeyIsPressed.meta ||
581+
KeyboardKeyIsPressed.shift
582+
)
583+
584+
dispatch(
585+
actions.setColumnLabelFilter({
586+
columnId,
587+
label: label.name,
588+
value: KeyboardKeyIsPressed.alt
589+
? false
590+
: true,
591+
removeIfAlreadySet,
592+
removeOthers,
593+
}),
594+
)
595+
}
596+
})()
597+
}
598+
style={sharedStyles.flexShrink1}
570599
>
571-
<Link
572-
TouchableComponent={GestureHandlerTouchableOpacity}
573-
enableUnderlineHover
574-
href="javascript:void(0)"
575-
openOnNewTab={false}
576-
onPress={
577-
!columnId
578-
? undefined
579-
: (() => {
580-
return () => {
581-
vibrateHapticFeedback()
582-
583-
const removeIfAlreadySet = !(
584-
KeyboardKeyIsPressed.meta ||
585-
KeyboardKeyIsPressed.shift
586-
)
587-
588-
const removeOthers = !(
589-
KeyboardKeyIsPressed.alt ||
590-
KeyboardKeyIsPressed.meta ||
591-
KeyboardKeyIsPressed.shift
592-
)
593-
594-
dispatch(
595-
actions.setColumnLabelFilter({
596-
columnId,
597-
label: label.name,
598-
value: KeyboardKeyIsPressed.alt
599-
? false
600-
: true,
601-
removeIfAlreadySet,
602-
removeOthers,
603-
}),
604-
)
605-
}
606-
})()
607-
}
608-
style={sharedStyles.flexShrink1}
609-
textProps={{
610-
color: 'foregroundColorMuted65',
611-
numberOfLines: 1,
612-
style: styles.labelText,
613-
}}
600+
<Label
601+
colorThemeColor={fixColorHexWithoutHash(label.color)}
602+
disableEmojis
603+
small
614604
>
615-
{stripEmojis(label.name.toLowerCase())}
616-
</Link>
617-
</Label>
605+
{label.name.toLowerCase()}
606+
</Label>
607+
</Link>
618608

619609
{index < labels.length - 1 && (
620610
<Spacer width={contentPadding / 2} />

packages/components/src/components/cards/partials/rows/LabelsView.tsx

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import { ScrollView, StyleSheet, ViewProps } from 'react-native'
44
import { GitHubLabel, Theme, ThemeColors } from '@devhub/core'
55
import { sharedStyles } from '../../../../styles/shared'
66
import { contentPadding } from '../../../../styles/variables'
7+
import { fixColorHexWithoutHash } from '../../../../utils/helpers/colors'
78
import { ConditionalWrap } from '../../../common/ConditionalWrap'
8-
import { hiddenLabelSizes, Label, LabelProps } from '../../../common/Label'
9+
import { Label, LabelProps } from '../../../common/Label'
910
import { ScrollViewWithOverlay } from '../../../common/ScrollViewWithOverlay'
1011
import { TouchableOpacity } from '../../../common/TouchableOpacity'
1112

@@ -15,7 +16,6 @@ export interface LabelsViewProps
1516
enableScrollView?: boolean
1617
enableScrollViewOverlay?: boolean
1718
fragment?: boolean
18-
hideText?: boolean
1919
labels: Array<{
2020
key?: string
2121
name: GitHubLabel['name']
@@ -40,7 +40,6 @@ export const LabelsView = (props: LabelsViewProps) => {
4040
enableScrollView,
4141
enableScrollViewOverlay,
4242
fragment,
43-
hideText,
4443
labels,
4544
startScrollAtEnd,
4645
style,
@@ -56,23 +55,9 @@ export const LabelsView = (props: LabelsViewProps) => {
5655
scrollViewRef.current.scrollToEnd({ animated: false })
5756
}, [scrollViewRef.current, startScrollAtEnd])
5857

59-
const horizontalSpacing = hideText
60-
? -hiddenLabelSizes.width / 8
61-
: contentPadding / 3
58+
const horizontalSpacing = contentPadding / 3
6259
const verticalSpacing = 1
6360

64-
const texts = labels
65-
.map(label => label && label.name)
66-
.filter(text => !!text && typeof text === 'string')
67-
68-
const tooltip = hideText
69-
? texts.length === 1
70-
? `Label: ${texts[0]}`
71-
: texts.length > 1
72-
? `Labels:\n${texts.join('\n')}`
73-
: ''
74-
: ''
75-
7661
return (
7762
<ConditionalWrap
7863
condition
@@ -93,7 +78,6 @@ export const LabelsView = (props: LabelsViewProps) => {
9378
},
9479
style,
9580
]}
96-
tooltip={tooltip}
9781
>
9882
<ConditionalWrap
9983
condition={!!enableScrollView}
@@ -134,8 +118,7 @@ export const LabelsView = (props: LabelsViewProps) => {
134118
{labels.map(label => (
135119
<Label
136120
key={label.key || label.name}
137-
backgroundThemeColor={backgroundThemeColor}
138-
colorThemeColor={label.color}
121+
colorThemeColor={fixColorHexWithoutHash(label.color)}
139122
containerStyle={[
140123
sharedStyles.alignSelfFlexStart,
141124
{
@@ -144,13 +127,10 @@ export const LabelsView = (props: LabelsViewProps) => {
144127
},
145128
]}
146129
disableEmojis
147-
hideText={hideText}
148-
outline={false}
149130
small
150-
transparent
151131
{...otherProps}
152132
>
153-
{hideText && !fragment ? '' : label.name.toLowerCase()}
133+
{label.name.toLowerCase()}
154134
</Label>
155135
))}
156136
</ConditionalWrap>

0 commit comments

Comments
 (0)