Skip to content

Commit

Permalink
Mention future column types: Issue/PR management
Browse files Browse the repository at this point in the history
  • Loading branch information
brunolemos committed Feb 7, 2019
1 parent c1ccf7e commit 8f94d2f
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 19 deletions.
12 changes: 9 additions & 3 deletions packages/components/src/components/common/H2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import { useCSSVariablesOrSpringAnimatedTheme } from '../../hooks/use-css-variab
import { contentPadding } from '../../styles/variables'
import { SpringAnimatedText } from '../animated/spring/SpringAnimatedText'

export type H2Props = TextProps & { children: string; withMargin?: boolean }
export type H2Props = TextProps & {
children: string
muted?: boolean
withMargin?: boolean
}

export function H2(props: H2Props) {
const springAnimatedTheme = useCSSVariablesOrSpringAnimatedTheme()

const { children, style, withMargin, ...otherProps } = props
const { children, muted, style, withMargin, ...otherProps } = props

return (
<SpringAnimatedText
Expand All @@ -19,7 +23,9 @@ export function H2(props: H2Props) {
{
marginBottom: withMargin ? contentPadding : undefined,
fontWeight: '600',
color: springAnimatedTheme.foregroundColor,
color: muted
? springAnimatedTheme.foregroundColorMuted50
: springAnimatedTheme.foregroundColor,
},
style,
]}
Expand Down
15 changes: 9 additions & 6 deletions packages/components/src/components/common/SubHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ import { Spacer } from './Spacer'
export interface SubHeaderProps {
children?: React.ReactNode
iconName?: ColumnHeaderItemProps['iconName']
muted?: boolean
title?: ColumnHeaderItemProps['title']
}

export function SubHeader(props: SubHeaderProps) {
const { children, iconName, title } = props
const { children, iconName, muted, title } = props

return (
<SpringAnimatedView
style={{
flexDirection: 'row',
justifyContent: 'flex-start',
alignSelf: 'stretch',
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'row',
padding: contentPadding,
}}
>
Expand All @@ -41,9 +42,11 @@ export function SubHeader(props: SubHeaderProps) {

{!!iconName && !!title && <Spacer width={contentPadding / 2} />}

{!!title && <H2 withMargin={false}>{title}</H2>}

<Spacer flex={1} minWidth={contentPadding / 2} />
{!!title && (
<H2 muted={muted} withMargin={false}>
{title}
</H2>
)}

{children}
</SpringAnimatedView>
Expand Down
59 changes: 49 additions & 10 deletions packages/components/src/components/modals/AddColumnModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { SpringAnimatedTouchableOpacity } from '../animated/spring/SpringAnimate
import { ColumnHeaderItem } from '../columns/ColumnHeaderItem'
import { ModalColumn } from '../columns/ModalColumn'
import { fabSize } from '../common/FAB'
import { H2 } from '../common/H2'
import { Link } from '../common/Link'
import { separatorTickSize } from '../common/Separator'
import { Spacer } from '../common/Spacer'
Expand All @@ -42,8 +43,10 @@ const columnTypes: Array<{
items: Array<{
title: string
icon: GitHubIcon
payload: AddColumnDetailsPayload
payload: AddColumnDetailsPayload | null
}>
soon?: boolean
soonLink?: string
}> = [
{
title: 'Notifications',
Expand Down Expand Up @@ -137,6 +140,25 @@ const columnTypes: Array<{
},
],
},
{
soon: true,
soonLink: 'https://github.com/devhubapp/devhub/issues/110',
title: 'Issue & PR Management',
type: 'activity', // TODO
icon: 'issue-opened',
items: [
{
title: 'Issues',
icon: 'issue-opened',
payload: null,
},
{
title: 'Pull Requests',
icon: 'git-pull-request',
payload: null,
},
],
},
]

function AddColumnModalItem({
Expand All @@ -149,7 +171,7 @@ function AddColumnModalItem({
availableWidth: number
disabled?: boolean
icon: GitHubIcon
payload: AddColumnDetailsPayload
payload: AddColumnDetailsPayload | null
title: string
}) {
const initialTheme = useTheme(theme => {
Expand Down Expand Up @@ -205,12 +227,15 @@ function AddColumnModalItem({
<SpringAnimatedTouchableOpacity
ref={touchableRef}
analyticsLabel={undefined}
disabled={disabled}
onPress={() =>
pushModal({
name: 'ADD_COLUMN_DETAILS',
params: payload,
})
disabled={disabled || !payload}
onPress={
payload
? () =>
pushModal({
name: 'ADD_COLUMN_DETAILS',
params: payload,
})
: undefined
}
onPressIn={() => {
if (Platform.realOS === 'web') return
Expand Down Expand Up @@ -294,7 +319,21 @@ export function AddColumnModal(props: AddColumnModalProps) {
>
{columnTypes.map((group, groupIndex) => (
<View key={`add-column-header-group-${groupIndex}`}>
<SubHeader title={group.title} />
<SubHeader muted={group.soon} title={group.title}>
{!!group.soon && (
<Link
analyticsLabel={`add-column-${group.title}-soon`}
href={group.soonLink}
>
<H2
muted
withMargin={false}
children=" (soon)"
style={{ flex: 1 }}
/>
</Link>
)}
</SubHeader>

<View
style={{
Expand All @@ -309,7 +348,7 @@ export function AddColumnModal(props: AddColumnModalProps) {
<AddColumnModalItem
key={`add-column-button-group-${groupIndex}-item-${itemIndex}`}
availableWidth={availableWidth}
disabled={hasReachedColumnLimit}
disabled={hasReachedColumnLimit || !item.payload}
icon={item.icon}
payload={item.payload}
title={item.title}
Expand Down

0 comments on commit 8f94d2f

Please sign in to comment.