Merge pull request #18162 from desktop/jc-icons-bigger-update

Update primer octicons and add support for all sizes
This commit is contained in:
Jose Cortinas 2024-02-22 16:12:41 -06:00 committed by GitHub
commit 7955530f59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
96 changed files with 5582 additions and 2048 deletions

View file

@ -216,6 +216,9 @@ overrides:
- files: 'script/**/*'
rules:
'@typescript-eslint/no-non-null-assertion': off
- files: 'app/src/ui/octicons/octicons.generated.ts'
rules:
'@typescript-eslint/naming-convention': off
parserOptions:
sourceType: module

View file

@ -4,7 +4,7 @@ import { TitleBar } from '../ui/window/title-bar'
import { encodePathAsUrl } from '../lib/path'
import { WindowState } from '../lib/window-state'
import { Octicon } from '../ui/octicons'
import * as OcticonSymbol from '../ui/octicons/octicons.generated'
import * as octicons from '../ui/octicons/octicons.generated'
import { Button } from '../ui/lib/button'
import { LinkButton } from '../ui/lib/link-button'
import { getVersion } from '../ui/lib/app-proxy'
@ -141,7 +141,7 @@ export class CrashApp extends React.Component<ICrashAppProps, ICrashAppState> {
return (
<header>
<Octicon symbol={OcticonSymbol.stop} className="error-icon" />
<Octicon symbol={octicons.stop} className="error-icon" />
<h1>{message}</h1>
</header>
)

View file

@ -24,7 +24,7 @@ import { writeGitAttributes } from './git-attributes'
import { getDefaultDir, setDefaultDir } from '../lib/default-dir'
import { Dialog, DialogContent, DialogFooter, DialogError } from '../dialog'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { LinkButton } from '../lib/link-button'
import { PopupType } from '../../models/popup'
import { Ref } from '../lib/ref'
@ -443,7 +443,7 @@ export class CreateRepository extends React.Component<
return (
<Row className="warning-helper-text">
<Octicon symbol={OcticonSymbol.alert} />
<Octicon symbol={octicons.alert} />
Will be created as {sanitizedName}
</Row>
)

View file

@ -2,7 +2,7 @@ import * as React from 'react'
import classNames from 'classnames'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { MenuItem } from '../../models/app-menu'
import { AccessText } from '../lib/access-text'
import { getPlatformSpecificNameOrSymbolForModifier } from '../../lib/menu-item'
@ -95,9 +95,9 @@ export class MenuListItem extends React.Component<IMenuListItemProps, {}> {
private getIcon(item: MenuItem): JSX.Element | null {
if (item.type === 'checkbox' && item.checked) {
return <Octicon className="icon" symbol={OcticonSymbol.check} />
return <Octicon className="icon" symbol={octicons.check} />
} else if (item.type === 'radio' && item.checked) {
return <Octicon className="icon" symbol={OcticonSymbol.dotFill} />
return <Octicon className="icon" symbol={octicons.dotFill} />
}
return null
@ -153,10 +153,7 @@ export class MenuListItem extends React.Component<IMenuListItemProps, {}> {
const arrow =
item.type === 'submenuItem' && this.props.renderSubMenuArrow !== false ? (
<Octicon
className="submenu-arrow"
symbol={OcticonSymbol.triangleRight}
/>
<Octicon className="submenu-arrow" symbol={octicons.triangleRight} />
) : null
const accelerator =

View file

@ -51,8 +51,8 @@ import {
BranchDropdown,
RevertProgress,
} from './toolbar'
import { iconForRepository, OcticonSymbolType } from './octicons'
import * as OcticonSymbol from './octicons/octicons.generated'
import { iconForRepository, OcticonSymbol } from './octicons'
import * as octicons from './octicons/octicons.generated'
import {
showCertificateTrustDialog,
sendReady,
@ -2882,17 +2882,17 @@ export class App extends React.Component<IAppProps, IAppState> {
const repository = selection ? selection.repository : null
let icon: OcticonSymbolType
let icon: OcticonSymbol
let title: string
if (repository) {
const alias = repository instanceof Repository ? repository.alias : null
icon = iconForRepository(repository)
title = alias ?? repository.name
} else if (this.state.repositories.length > 0) {
icon = OcticonSymbol.repo
icon = octicons.repo
title = __DARWIN__ ? 'Select a Repository' : 'Select a repository'
} else {
icon = OcticonSymbol.repo
icon = octicons.repo
title = __DARWIN__ ? 'No Repositories' : 'No repositories'
}

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
interface IBannerProps {
readonly id?: string
@ -37,7 +37,7 @@ export class Banner extends React.Component<IBannerProps, {}> {
return (
<div className="close">
<button onClick={onDismissed} aria-label="Dismiss this message">
<Octicon symbol={OcticonSymbol.x} />
<Octicon symbol={octicons.x} />
</button>
</div>
)

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Banner } from './banner'
export function BranchAlreadyUpToDate({
@ -29,7 +29,7 @@ export function BranchAlreadyUpToDate({
return (
<Banner id="successful-merge" timeout={5000} onDismissed={onDismissed}>
<div className="green-circle">
<Octicon className="check-icon" symbol={OcticonSymbol.check} />
<Octicon className="check-icon" symbol={octicons.check} />
</div>
<div className="banner-message">{message}</div>
</Banner>

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Banner } from './banner'
import { LinkButton } from '../lib/link-button'
@ -35,7 +35,7 @@ export class CherryPickConflictsBanner extends React.Component<
dismissable={false}
onDismissed={this.onDismissed}
>
<Octicon className="alert-icon" symbol={OcticonSymbol.alert} />
<Octicon className="alert-icon" symbol={octicons.alert} />
<div className="banner-message">
<span>
Resolve conflicts to continue cherry-picking onto{' '}

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Banner } from './banner'
import { LinkButton } from '../lib/link-button'
@ -41,7 +41,7 @@ export class ConflictsFoundBanner extends React.Component<
dismissable={false}
onDismissed={this.onDismissed}
>
<Octicon className="alert-icon" symbol={OcticonSymbol.alert} />
<Octicon className="alert-icon" symbol={octicons.alert} />
<div className="banner-message">
<span>
Resolve conflicts to continue {this.props.operationDescription}.

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Banner } from './banner'
import { Dispatcher } from '../dispatcher'
import { Popup } from '../../models/popup'
@ -31,7 +31,7 @@ export class MergeConflictsBanner extends React.Component<
dismissable={false}
onDismissed={this.props.onDismissed}
>
<Octicon className="alert-icon" symbol={OcticonSymbol.alert} />
<Octicon className="alert-icon" symbol={octicons.alert} />
<div className="banner-message">
<span>
Resolve conflicts and commit to merge into{' '}

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Banner } from './banner'
import { Dispatcher } from '../dispatcher'
import { LinkButton } from '../lib/link-button'
@ -38,7 +38,7 @@ export class RebaseConflictsBanner extends React.Component<
dismissable={false}
onDismissed={this.onDismissed}
>
<Octicon className="alert-icon" symbol={OcticonSymbol.alert} />
<Octicon className="alert-icon" symbol={octicons.alert} />
<div className="banner-message">
<span>
Resolve conflicts to continue rebasing{' '}

View file

@ -1,7 +1,7 @@
import * as React from 'react'
import { LinkButton } from '../lib/link-button'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Banner } from './banner'
interface ISuccessBannerProps {
@ -36,7 +36,7 @@ export class SuccessBanner extends React.Component<ISuccessBannerProps, {}> {
onDismissed={this.props.onDismissed}
>
<div className="green-circle">
<Octicon className="check-icon" symbol={OcticonSymbol.check} />
<Octicon className="check-icon" symbol={octicons.checkCircleFill} />
</div>
<div className="banner-message">
<span className="success-contents">{this.props.children}</span>

View file

@ -7,7 +7,7 @@ import {
updateStore,
} from '../lib/update-store'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { PopupType } from '../../models/popup'
import { shell } from '../../lib/app-shell'
@ -39,7 +39,7 @@ export class UpdateAvailable extends React.Component<
{!this.props.isUpdateShowcaseVisible && (
<Octicon
className="download-icon"
symbol={OcticonSymbol.desktopDownload}
symbol={octicons.desktopDownload}
/>
)}

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Banner } from './banner'
import { LinkButton } from '../lib/link-button'
import { setNumber } from '../../lib/local-storage'
@ -23,7 +23,7 @@ export class WindowsVersionNoLongerSupportedBanner extends React.Component<{
dismissable={true}
onDismissed={this.onDismissed}
>
<Octicon className="alert-icon" symbol={OcticonSymbol.alert} />
<Octicon className="alert-icon" symbol={octicons.alert} />
<div className="banner-message">
<span>
This operating system is no longer supported. Software updates have

View file

@ -3,7 +3,7 @@ import * as React from 'react'
import { IMatches } from '../../lib/fuzzy-find'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { HighlightText } from '../lib/highlight-text'
import { dragAndDropManager } from '../../lib/drag-and-drop-manager'
import { DragType, DropTargetType } from '../../models/drag-drop'
@ -92,7 +92,7 @@ export class BranchListItem extends React.Component<
public render() {
const { lastCommitDate, isCurrentBranch, name } = this.props
const icon = isCurrentBranch ? OcticonSymbol.check : OcticonSymbol.gitBranch
const icon = isCurrentBranch ? octicons.check : octicons.gitBranch
const className = classNames('branches-list-item', {
'drop-target': this.state.isDragInProgress,
})

View file

@ -17,7 +17,7 @@ import { TabBar } from '../tab-bar'
import { Row } from '../lib/row'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Button } from '../lib/button'
import { BranchList } from './branch-list'
@ -169,7 +169,7 @@ export class BranchesContainer extends React.Component<
onClick={this.onMergeClick}
tooltip={`Choose a branch to merge into ${currentBranch.name}`}
>
<Octicon className="icon" symbol={OcticonSymbol.gitMerge} />
<Octicon className="icon" symbol={octicons.gitMerge} />
Choose a branch to merge into <strong>{currentBranch.name}</strong>
</Button>
</Row>
@ -294,7 +294,7 @@ export class BranchesContainer extends React.Component<
onMouseLeave={this.onMouseLeaveNewBranchDrop}
onMouseUp={this.onMouseUpNewBranchDrop}
>
<Octicon className="icon" symbol={OcticonSymbol.plus} />
<Octicon className="icon" symbol={octicons.plus} />
<div className="name">{label}</div>
</div>
)

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon, OcticonSymbolType } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { Octicon, OcticonSymbol } from '../octicons'
import * as octicons from '../octicons/octicons.generated'
import classNames from 'classnames'
import { GitHubRepository } from '../../models/github-repository'
import { DisposableLike } from 'event-kit'
@ -123,28 +123,28 @@ export class CIStatus extends React.PureComponent<
export function getSymbolForCheck(
check: ICombinedRefCheck | IRefCheck | IAPIWorkflowJobStep
): OcticonSymbolType {
): OcticonSymbol {
switch (check.conclusion) {
case 'timed_out':
return OcticonSymbol.x
return octicons.x
case 'failure':
return OcticonSymbol.x
return octicons.x
case 'neutral':
return OcticonSymbol.squareFill
return octicons.squareFill
case 'success':
return OcticonSymbol.check
return octicons.check
case 'cancelled':
return OcticonSymbol.stop
return octicons.stop
case 'action_required':
return OcticonSymbol.alert
return octicons.alert
case 'skipped':
return OcticonSymbol.skip
return octicons.skip
case 'stale':
return OcticonSymbol.issueReopened
return octicons.issueReopened
}
// Pending
return OcticonSymbol.dotFill
return octicons.dotFill
}
export function getClassNameForCheck(
@ -170,12 +170,12 @@ export function getClassNameForCheck(
export function getSymbolForLogStep(
logStep: IAPIWorkflowJobStep
): OcticonSymbolType {
): OcticonSymbol {
switch (logStep.conclusion) {
case 'success':
return OcticonSymbol.checkCircleFill
return octicons.checkCircleFill
case 'failure':
return OcticonSymbol.xCircleFill
return octicons.xCircleFill
}
return getSymbolForCheck(logStep)

View file

@ -1,7 +1,7 @@
import * as React from 'react'
import classNames from 'classnames'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { CIStatus } from './ci-status'
import { HighlightText } from '../lib/highlight-text'
import { IMatches } from '../../lib/fuzzy-find'
@ -139,8 +139,8 @@ export class PullRequestListItem extends React.Component<
className="icon"
symbol={
this.props.draft
? OcticonSymbol.gitPullRequestDraft
: OcticonSymbol.gitPullRequest
? octicons.gitPullRequestDraft
: octicons.gitPullRequest
}
/>
</div>

View file

@ -44,8 +44,8 @@ import {
Foldout,
} from '../../lib/app-state'
import { ContinueRebase } from './continue-rebase'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { Octicon, OcticonSymbolVariant } from '../octicons'
import * as octicons from '../octicons/octicons.generated'
import { IStashEntry } from '../../models/stash-entry'
import classNames from 'classnames'
import { hasWritePermission } from '../../models/github-repository'
@ -59,19 +59,19 @@ import { RepoRulesInfo } from '../../models/repo-rules'
import { IAheadBehind } from '../../models/branch'
const RowHeight = 29
const StashIcon: OcticonSymbol.OcticonSymbolType = {
const StashIcon: OcticonSymbolVariant = {
w: 16,
h: 16,
d:
p: [
'M10.5 1.286h-9a.214.214 0 0 0-.214.214v9a.214.214 0 0 0 .214.214h9a.214.214 0 0 0 ' +
'.214-.214v-9a.214.214 0 0 0-.214-.214zM1.5 0h9A1.5 1.5 0 0 1 12 1.5v9a1.5 1.5 0 0 1-1.5 ' +
'1.5h-9A1.5 1.5 0 0 1 0 10.5v-9A1.5 1.5 0 0 1 1.5 0zm5.712 7.212a1.714 1.714 0 1 ' +
'1-2.424-2.424 1.714 1.714 0 0 1 2.424 2.424zM2.015 12.71c.102.729.728 1.29 1.485 ' +
'1.29h9a1.5 1.5 0 0 0 1.5-1.5v-9a1.5 1.5 0 0 0-1.29-1.485v1.442a.216.216 0 0 1 ' +
'.004.043v9a.214.214 0 0 1-.214.214h-9a.216.216 0 0 1-.043-.004H2.015zm2 2c.102.729.728 ' +
'1.29 1.485 1.29h9a1.5 1.5 0 0 0 1.5-1.5v-9a1.5 1.5 0 0 0-1.29-1.485v1.442a.216.216 0 0 1 ' +
'.004.043v9a.214.214 0 0 1-.214.214h-9a.216.216 0 0 1-.043-.004H4.015z',
fr: 'evenodd',
'.214-.214v-9a.214.214 0 0 0-.214-.214zM1.5 0h9A1.5 1.5 0 0 1 12 1.5v9a1.5 1.5 0 0 1-1.5 ' +
'1.5h-9A1.5 1.5 0 0 1 0 10.5v-9A1.5 1.5 0 0 1 1.5 0zm5.712 7.212a1.714 1.714 0 1 ' +
'1-2.424-2.424 1.714 1.714 0 0 1 2.424 2.424zM2.015 12.71c.102.729.728 1.29 1.485 ' +
'1.29h9a1.5 1.5 0 0 0 1.5-1.5v-9a1.5 1.5 0 0 0-1.29-1.485v1.442a.216.216 0 0 1 ' +
'.004.043v9a.214.214 0 0 1-.214.214h-9a.216.216 0 0 1-.043-.004H2.015zm2 2c.102.729.728 ' +
'1.29 1.485 1.29h9a1.5 1.5 0 0 0 1.5-1.5v-9a1.5 1.5 0 0 0-1.29-1.485v1.442a.216.216 0 0 1 ' +
'.004.043v9a.214.214 0 0 1-.214.214h-9a.216.216 0 0 1-.043-.004H4.015z',
],
}
const GitIgnoreFileName = '.gitignore'
@ -935,7 +935,7 @@ export class ChangesList extends React.Component<
>
<Octicon className="stack-icon" symbol={StashIcon} />
<div className="text">Stashed Changes</div>
<Octicon symbol={OcticonSymbol.chevronRight} />
<Octicon symbol={octicons.chevronRight} />
</button>
)
}

View file

@ -10,7 +10,7 @@ import {
import { IAvatarUser } from '../../models/avatar'
import { Avatar } from '../lib/avatar'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { LinkButton } from '../lib/link-button'
import { OkCancelButtonGroup } from '../dialog'
import { getConfigValue } from '../../lib/git/config'
@ -190,7 +190,7 @@ export class CommitMessageAvatar extends React.Component<
error: isError,
warning: !isError,
})
const symbol = isError ? OcticonSymbol.stop : OcticonSymbol.alert
const symbol = isError ? octicons.stop : octicons.alert
return (
<div className={classes} ref={this.warningBadgeRef}>

View file

@ -13,8 +13,8 @@ import { Button } from '../lib/button'
import { Loading } from '../lib/loading'
import { AuthorInput } from '../lib/author-input/author-input'
import { FocusContainer } from '../lib/focus-container'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { Octicon, OcticonSymbolVariant } from '../octicons'
import * as octicons from '../octicons/octicons.generated'
import { Author, UnknownAuthor, isKnownAuthor } from '../../models/author'
import { IMenuItem } from '../../lib/menu-item'
import { Commit, ICommitContext } from '../../models/commit'
@ -57,16 +57,17 @@ import { Dispatcher } from '../dispatcher'
import { formatCommitMessage } from '../../lib/format-commit-message'
import { useRepoRulesLogic } from '../../lib/helpers/repo-rules'
const addAuthorIcon = {
const addAuthorIcon: OcticonSymbolVariant = {
w: 18,
h: 13,
d:
p: [
'M14 6V4.25a.75.75 0 0 1 1.5 0V6h1.75a.75.75 0 1 1 0 1.5H15.5v1.75a.75.75 0 0 ' +
'1-1.5 0V7.5h-1.75a.75.75 0 1 1 0-1.5H14zM8.5 4a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 ' +
'0zm.063 3.064a3.995 3.995 0 0 0 1.2-4.429A3.996 3.996 0 0 0 8.298.725a4.01 4.01 0 0 ' +
'0-6.064 1.91 3.987 3.987 0 0 0 1.2 4.43A5.988 5.988 0 0 0 0 12.2a.748.748 0 0 0 ' +
'.716.766.751.751 0 0 0 .784-.697 4.49 4.49 0 0 1 1.39-3.04 4.51 4.51 0 0 1 6.218 ' +
'0 4.49 4.49 0 0 1 1.39 3.04.748.748 0 0 0 .786.73.75.75 0 0 0 .714-.8 5.989 5.989 0 0 0-3.435-5.136z',
'1-1.5 0V7.5h-1.75a.75.75 0 1 1 0-1.5H14zM8.5 4a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 ' +
'0zm.063 3.064a3.995 3.995 0 0 0 1.2-4.429A3.996 3.996 0 0 0 8.298.725a4.01 4.01 0 0 ' +
'0-6.064 1.91 3.987 3.987 0 0 0 1.2 4.43A5.988 5.988 0 0 0 0 12.2a.748.748 0 0 0 ' +
'.716.766.751.751 0 0 0 .784-.697 4.49 4.49 0 0 1 1.39-3.04 4.51 4.51 0 0 1 6.218 ' +
'0 4.49 4.49 0 0 1 1.39 3.04.748.748 0 0 0 .786.73.75.75 0 0 0 .714-.8 5.989 5.989 0 0 0-3.435-5.136z',
],
}
interface ICommitMessageProps {
@ -1279,7 +1280,7 @@ export class CommitMessage extends React.Component<
tooltipClassName="length-hint-tooltip"
ariaLabel="Open Summary Length Info"
>
<Octicon symbol={OcticonSymbol.lightBulb} />
<Octicon symbol={octicons.lightBulb} />
</ToggledtippedContent>
)
}
@ -1313,7 +1314,7 @@ export class CommitMessage extends React.Component<
onClick={this.toggleRuleFailurePopover}
>
<Octicon
symbol={canBypass ? OcticonSymbol.alert : OcticonSymbol.stop}
symbol={canBypass ? octicons.alert : octicons.stop}
className={canBypass ? 'warning-icon' : 'error-icon'}
/>
</button>

View file

@ -1,7 +1,7 @@
import * as React from 'react'
import { assertNever } from '../../lib/fatal-error'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
export enum CommitWarningIcon {
Warning,
@ -11,20 +11,20 @@ export enum CommitWarningIcon {
const renderIcon = (icon: CommitWarningIcon) => {
let className = ''
let symbol = OcticonSymbol.alert
let symbol = octicons.alert
switch (icon) {
case CommitWarningIcon.Warning:
className = 'warning-icon'
symbol = OcticonSymbol.alert
symbol = octicons.alert
break
case CommitWarningIcon.Information:
className = 'information-icon'
symbol = OcticonSymbol.info
symbol = octicons.info
break
case CommitWarningIcon.Error:
className = 'error-icon'
symbol = OcticonSymbol.stop
symbol = octicons.stop
break
default:
assertNever(icon, `Unexpected icon value ${icon}`)

View file

@ -4,7 +4,7 @@ import { IRefCheck } from '../../lib/ci-checks/ci-checks'
import { IMenuItem, showContextualMenu } from '../../lib/menu-item'
import { Button } from '../lib/button'
import { Octicon, syncClockwise } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
interface ICICheckReRunButtonProps {
readonly disabled: boolean
@ -44,7 +44,7 @@ export class CICheckReRunButton extends React.PureComponent<ICICheckReRunButtonP
const text =
this.props.canReRunFailed && this.failedChecksExist ? (
<>
Re-run <Octicon symbol={OcticonSymbol.triangleDown} />
Re-run <Octicon symbol={octicons.triangleDown} />
</>
) : (
'Re-run Checks'

View file

@ -5,7 +5,7 @@ import { IRefCheck } from '../../lib/ci-checks/ci-checks'
import { Octicon } from '../octicons'
import { getClassNameForCheck, getSymbolForCheck } from '../branches/ci-status'
import classNames from 'classnames'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { TooltippedContent } from '../lib/tooltipped-content'
import { CICheckRunActionsJobStepList } from './ci-check-run-actions-job-step-list'
import { IAPIWorkflowJobStep } from '../../lib/api'
@ -123,9 +123,7 @@ export class CICheckRunListItem extends React.PureComponent<
<div className="job-step-toggled-indicator">
<Octicon
symbol={
isCheckRunExpanded
? OcticonSymbol.chevronUp
: OcticonSymbol.chevronDown
isCheckRunExpanded ? octicons.chevronUp : octicons.chevronDown
}
/>
</div>
@ -181,7 +179,7 @@ export class CICheckRunListItem extends React.PureComponent<
return (
<div className={classes} onClick={this.rerunJob}>
<TooltippedContent tooltip={tooltip}>
<Octicon symbol={OcticonSymbol.sync} />
<Octicon symbol={octicons.sync} />
</TooltippedContent>
</div>
)

View file

@ -24,7 +24,7 @@ import {
import { CICheckRunList } from './ci-check-run-list'
import { encodePathAsUrl } from '../../lib/path'
import { PopupType } from '../../models/popup'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Donut } from '../donut'
import {
supportsRerunningChecks,
@ -253,14 +253,14 @@ export class CICheckRunPopover extends React.PureComponent<
return (
<Octicon
className={'completeness-indicator-success'}
symbol={OcticonSymbol.checkCircleFill}
symbol={octicons.checkCircleFill}
/>
)
case allFailure: {
return (
<Octicon
className={'completeness-indicator-error'}
symbol={OcticonSymbol.xCircleFill}
symbol={octicons.xCircleFill}
/>
)
}

View file

@ -11,7 +11,7 @@ import {
IAPICheckSuite,
} from '../../lib/api'
import { Octicon } from '../octicons'
import * as OcticonSymbol from './../octicons/octicons.generated'
import * as octicons from './../octicons/octicons.generated'
import { encodePathAsUrl } from '../../lib/path'
import { offsetFromNow } from '../../lib/offset-from'
@ -188,7 +188,7 @@ export class CICheckRunRerunDialog extends React.Component<
}${pluralize} that cannot be re-run`
return (
<div className="non-re-run-info warning-helper-text">
<Octicon symbol={OcticonSymbol.alert} />
<Octicon symbol={octicons.alert} />
{`${warningPrefix}. A check run cannot be re-run if the check is more than one month old,
the check or its dependent has not completed, or the check is not configured to be

View file

@ -1,7 +1,7 @@
import { IAPIRepository } from '../../lib/api'
import { IFilterListGroup, IFilterListItem } from '../lib/filter-list'
import { OcticonSymbolType } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { OcticonSymbol } from '../octicons'
import * as octicons from '../octicons/octicons.generated'
import entries from 'lodash/entries'
import groupBy from 'lodash/groupBy'
import { caseInsensitiveEquals, compare } from '../../lib/compare'
@ -20,7 +20,7 @@ export interface ICloneableRepositoryListItem extends IFilterListItem {
readonly name: string
/** The icon for the repo. */
readonly icon: OcticonSymbolType
readonly icon: OcticonSymbol
/** The clone URL. */
readonly url: string
@ -29,15 +29,15 @@ export interface ICloneableRepositoryListItem extends IFilterListItem {
readonly archived?: boolean
}
function getIcon(gitHubRepo: IAPIRepository): OcticonSymbolType {
function getIcon(gitHubRepo: IAPIRepository): OcticonSymbol {
if (gitHubRepo.private) {
return OcticonSymbol.lock
return octicons.lock
}
if (gitHubRepo.fork) {
return OcticonSymbol.repoForked
return octicons.repoForked
}
return OcticonSymbol.repo
return octicons.repo
}
const toListItems = (repositories: ReadonlyArray<IAPIRepository>) =>

View file

@ -3,7 +3,7 @@ import * as React from 'react'
import { CloningRepository } from '../models/cloning-repository'
import { ICloneProgress } from '../models/progress'
import { Octicon } from './octicons'
import * as OcticonSymbol from './octicons/octicons.generated'
import * as octicons from './octicons/octicons.generated'
import { UiView } from './ui-view'
import { TooltippedContent } from './lib/tooltipped-content'
@ -25,7 +25,7 @@ export class CloningRepositoryView extends React.Component<
return (
<UiView id="cloning-repository-view">
<div className="title-container">
<Octicon symbol={OcticonSymbol.desktopDownload} />
<Octicon symbol={octicons.desktopDownload} />
<div className="title">Cloning {this.props.repository.name}</div>
</div>
<progress value={progressValue} />

View file

@ -1,6 +1,6 @@
import { clipboard } from 'electron'
import React from 'react'
import * as OcticonSymbol from './octicons/octicons.generated'
import * as octicons from './octicons/octicons.generated'
import { Octicon } from './octicons'
import { sleep } from '../lib/promise'
import { Button } from './lib/button'
@ -41,9 +41,9 @@ export class CopyButton extends React.Component<
public renderSymbol() {
const { showCopied } = this.state
const symbol = showCopied ? OcticonSymbol.check : OcticonSymbol.copy
const symbol = showCopied ? octicons.check : octicons.copy
return <Octicon symbol={symbol} />
return <Octicon symbol={symbol} height={24} />
}
public render() {

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
/**
* A component used for displaying short error messages inline
@ -17,7 +17,7 @@ export class DialogError extends React.Component {
public render() {
return (
<div className="dialog-banner dialog-error" role="alert">
<Octicon symbol={OcticonSymbol.stop} />
<Octicon symbol={octicons.stop} />
<div>{this.props.children}</div>
</div>
)

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon, syncClockwise } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
interface IDialogHeaderProps {
/**
@ -67,7 +67,7 @@ export class DialogHeader extends React.Component<IDialogHeaderProps, {}> {
onClick={this.onCloseButtonClick}
aria-label="Close"
>
<Octicon symbol={OcticonSymbol.x} />
<Octicon symbol={octicons.x} />
</button>
)
}

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
/**
* A component used for displaying short success messages inline
@ -17,7 +17,7 @@ export class DialogSuccess extends React.Component {
public render() {
return (
<div className="dialog-banner dialog-success" role="alert">
<Octicon symbol={OcticonSymbol.check} />
<Octicon symbol={octicons.check} />
<div>{this.props.children}</div>
</div>
)

View file

@ -1,6 +1,6 @@
import React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { LinkButton } from '../lib/link-button'
import { ITextDiff, LineEndingsChange } from '../../models/diff'
@ -34,7 +34,7 @@ export class DiffContentsWarning extends React.Component<IDiffContentsWarningPro
<div className="diff-contents-warning-container">
{items.map((item, i) => (
<div className="diff-contents-warning" key={i}>
<Octicon symbol={OcticonSymbol.alert} />
<Octicon symbol={octicons.alert} />
{this.getWarningMessageForItem(item)}
</div>
))}

View file

@ -1,7 +1,7 @@
import * as React from 'react'
import { Checkbox, CheckboxValue } from '../lib/checkbox'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { RadioButton } from '../lib/radio-button'
import {
Popover,
@ -99,9 +99,9 @@ export class DiffOptions extends React.Component<
{buttonLabel}
</Tooltip>
<span ref={this.gearIconRef}>
<Octicon symbol={OcticonSymbol.gear} />
<Octicon symbol={octicons.gear} />
</span>
<Octicon symbol={OcticonSymbol.triangleDown} />
<Octicon symbol={octicons.triangleDown} />
</button>
{this.state.isPopoverOpen && this.renderPopover()}
</div>

View file

@ -10,7 +10,7 @@ import {
import { ILineTokens } from '../../lib/highlighter/types'
import classNames from 'classnames'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { narrowNoNewlineSymbol } from './text-diff'
import { shallowEquals, structuralEquals } from '../../lib/equality'
import { DiffHunkExpansionType, DiffSelectionType } from '../../models/diff'
@ -422,7 +422,7 @@ export class SideBySideDiffRow extends React.Component<
// This can only be the first hunk
case DiffHunkExpansionType.Up:
return {
icon: OcticonSymbol.foldUp,
icon: octicons.foldUp,
title: 'Expand Up',
handler: this.onExpandHunk(hunkIndex, expansionType),
}
@ -430,13 +430,13 @@ export class SideBySideDiffRow extends React.Component<
// second to last hunk down.
case DiffHunkExpansionType.Down:
return {
icon: OcticonSymbol.foldDown,
icon: octicons.foldDown,
title: 'Expand Down',
handler: this.onExpandHunk(hunkIndex - 1, expansionType),
}
case DiffHunkExpansionType.Short:
return {
icon: OcticonSymbol.fold,
icon: octicons.fold,
title: 'Expand All',
handler: this.onExpandHunk(hunkIndex, expansionType),
}

View file

@ -3,7 +3,7 @@ import { parseRepositoryIdentifier } from '../../lib/remote-parsing'
import { ISubmoduleDiff } from '../../models/diff'
import { LinkButton } from '../lib/link-button'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { SuggestedAction } from '../suggested-actions'
import { Ref } from '../lib/ref'
import { CopyButton } from '../copy-button'
@ -11,23 +11,23 @@ import { shortenSHA } from '../../models/commit'
type SubmoduleItemIcon =
| {
readonly octicon: typeof OcticonSymbol.info
readonly octicon: typeof octicons.info
readonly className: 'info-icon'
}
| {
readonly octicon: typeof OcticonSymbol.diffModified
readonly octicon: typeof octicons.diffModified
readonly className: 'modified-icon'
}
| {
readonly octicon: typeof OcticonSymbol.diffAdded
readonly octicon: typeof octicons.diffAdded
readonly className: 'added-icon'
}
| {
readonly octicon: typeof OcticonSymbol.diffRemoved
readonly octicon: typeof octicons.diffRemoved
readonly className: 'removed-icon'
}
| {
readonly octicon: typeof OcticonSymbol.fileDiff
readonly octicon: typeof octicons.fileDiff
readonly className: 'untracked-icon'
}
@ -82,7 +82,7 @@ export class SubmoduleDiff extends React.Component<ISubmoduleDiffProps> {
: ` (${repoIdentifier.hostname})`
return this.renderSubmoduleDiffItem(
{ octicon: OcticonSymbol.info, className: 'info-icon' },
{ octicon: octicons.info, className: 'info-icon' },
<>
This is a submodule based on the repository{' '}
<LinkButton
@ -107,7 +107,7 @@ export class SubmoduleDiff extends React.Component<ISubmoduleDiffProps> {
if (oldSHA !== null && newSHA !== null) {
return this.renderSubmoduleDiffItem(
{ octicon: OcticonSymbol.diffModified, className: 'modified-icon' },
{ octicon: octicons.diffModified, className: 'modified-icon' },
<>
This submodule changed its commit from{' '}
{this.renderCommitSHA(oldSHA, 'previous')} to{' '}
@ -116,7 +116,7 @@ export class SubmoduleDiff extends React.Component<ISubmoduleDiffProps> {
)
} else if (oldSHA === null && newSHA !== null) {
return this.renderSubmoduleDiffItem(
{ octicon: OcticonSymbol.diffAdded, className: 'added-icon' },
{ octicon: octicons.diffAdded, className: 'added-icon' },
<>
This submodule {verb} added pointing at commit{' '}
{this.renderCommitSHA(newSHA)}.{suffix}
@ -124,7 +124,7 @@ export class SubmoduleDiff extends React.Component<ISubmoduleDiffProps> {
)
} else if (oldSHA !== null && newSHA === null) {
return this.renderSubmoduleDiffItem(
{ octicon: OcticonSymbol.diffRemoved, className: 'removed-icon' },
{ octicon: octicons.diffRemoved, className: 'removed-icon' },
<>
This submodule {verb} removed while it was pointing at commit{' '}
{this.renderCommitSHA(oldSHA)}.{suffix}
@ -164,7 +164,7 @@ export class SubmoduleDiff extends React.Component<ISubmoduleDiffProps> {
: 'modified'
return this.renderSubmoduleDiffItem(
{ octicon: OcticonSymbol.fileDiff, className: 'untracked-icon' },
{ octicon: octicons.fileDiff, className: 'untracked-icon' },
<>
This submodule has {changes} changes. Those changes must be committed
inside of the submodule before they can be part of the parent

View file

@ -52,18 +52,21 @@ import {
DiffExpansionKind,
expandWholeTextDiff,
} from './text-diff-expansion'
import { OcticonSymbolVariant } from '../octicons'
import { createOcticonElement } from '../octicons/octicon'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { WhitespaceHintPopover } from './whitespace-hint-popover'
import { PopoverAnchorPosition } from '../lib/popover'
import { DiffContentsWarning } from './diff-contents-warning'
// This is a custom version of the no-newline octicon that's exactly as
// tall as it needs to be (8px) which helps with aligning it on the line.
export const narrowNoNewlineSymbol = {
export const narrowNoNewlineSymbol: OcticonSymbolVariant = {
w: 16,
h: 8,
d: 'm 16,1 0,3 c 0,0.55 -0.45,1 -1,1 l -3,0 0,2 -3,-3 3,-3 0,2 2,0 0,-2 2,0 z M 8,4 C 8,6.2 6.2,8 4,8 1.8,8 0,6.2 0,4 0,1.8 1.8,0 4,0 6.2,0 8,1.8 8,4 Z M 1.5,5.66 5.66,1.5 C 5.18,1.19 4.61,1 4,1 2.34,1 1,2.34 1,4 1,4.61 1.19,5.17 1.5,5.66 Z M 7,4 C 7,3.39 6.81,2.83 6.5,2.34 L 2.34,6.5 C 2.82,6.81 3.39,7 4,7 5.66,7 7,5.66 7,4 Z',
p: [
'm 16,1 0,3 c 0,0.55 -0.45,1 -1,1 l -3,0 0,2 -3,-3 3,-3 0,2 2,0 0,-2 2,0 z M 8,4 C 8,6.2 6.2,8 4,8 1.8,8 0,6.2 0,4 0,1.8 1.8,0 4,0 6.2,0 8,1.8 8,4 Z M 1.5,5.66 5.66,1.5 C 5.18,1.19 4.61,1 4,1 2.34,1 1,2.34 1,4 1,4.61 1.19,5.17 1.5,5.66 Z M 7,4 C 7,3.39 6.81,2.83 6.5,2.34 L 2.34,6.5 C 2.82,6.81 3.39,7 4,7 5.66,7 7,5.66 7,4 Z',
],
}
type ChangedFile = WorkingDirectoryFileChange | CommittedFileChange
@ -101,7 +104,7 @@ function createNoNewlineIndicatorWidget() {
const widget = document.createElement('span')
const titleId = uuid()
const { w, h, d } = narrowNoNewlineSymbol
const { w, h, p } = narrowNoNewlineSymbol
const xmlns = 'http://www.w3.org/2000/svg'
const svgElem = document.createElementNS(xmlns, 'svg')
@ -119,7 +122,7 @@ function createNoNewlineIndicatorWidget() {
const pathElem = document.createElementNS(xmlns, 'path')
pathElem.setAttribute('role', 'presentation')
pathElem.setAttribute('d', d)
pathElem.setAttribute('d', p[0])
pathElem.textContent = 'No newline at end of file'
svgElem.appendChild(pathElem)
@ -1127,7 +1130,7 @@ export class TextDiff extends React.Component<ITextDiffProps, ITextDiffState> {
marker.appendChild(hunkExpandUpHandle)
hunkExpandUpHandle.appendChild(
createOcticonElement(OcticonSymbol.foldUp, 'hunk-expand-icon')
createOcticonElement(octicons.foldUp, 'hunk-expand-icon')
)
const hunkExpandDownHandle = document.createElement('button')
@ -1143,7 +1146,7 @@ export class TextDiff extends React.Component<ITextDiffProps, ITextDiffState> {
marker.appendChild(hunkExpandDownHandle)
hunkExpandDownHandle.appendChild(
createOcticonElement(OcticonSymbol.foldDown, 'hunk-expand-icon')
createOcticonElement(octicons.foldDown, 'hunk-expand-icon')
)
const hunkExpandWholeHandle = document.createElement('button')
@ -1160,7 +1163,7 @@ export class TextDiff extends React.Component<ITextDiffProps, ITextDiffState> {
hunkExpandWholeHandle.appendChild(
createOcticonElement(
OcticonSymbol.foldDown,
octicons.foldDown,
'hunk-expand-icon',
'hunk-expand-down-icon'
)
@ -1168,7 +1171,7 @@ export class TextDiff extends React.Component<ITextDiffProps, ITextDiffState> {
hunkExpandWholeHandle.appendChild(
createOcticonElement(
OcticonSymbol.foldUp,
octicons.foldUp,
'hunk-expand-icon',
'hunk-expand-up-icon'
)
@ -1176,7 +1179,7 @@ export class TextDiff extends React.Component<ITextDiffProps, ITextDiffState> {
hunkExpandWholeHandle.appendChild(
createOcticonElement(
OcticonSymbol.unfold,
octicons.unfold,
'hunk-expand-icon',
'hunk-expand-short-icon'
)

View file

@ -8,7 +8,7 @@ import { DragType, DropTarget, DropTargetType } from '../../models/drag-drop'
import { GitHubRepository } from '../../models/github-repository'
import { CommitListItem } from '../history/commit-list-item'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Account } from '../../models/account'
interface ICommitDragElementProps {
@ -79,7 +79,7 @@ export class CommitDragElement extends React.Component<
switch (currentDropTarget.type) {
case DropTargetType.Branch:
const copyToPlus = __DARWIN__ ? null : (
<Octicon className="copy-to-icon" symbol={OcticonSymbol.plus} />
<Octicon className="copy-to-icon" symbol={octicons.plus} />
)
toolTipContents = (
<>

View file

@ -2,7 +2,7 @@ import classNames from 'classnames'
import React from 'react'
import { Button } from './lib/button'
import { Octicon } from './octicons'
import * as OcticonSymbol from './octicons/octicons.generated'
import * as octicons from './octicons/octicons.generated'
import { MenuPane } from './app-menu'
import { ICheckboxMenuItem, MenuItem } from '../models/app-menu'
import { ClickSource, SelectionSource } from './lib/list'
@ -383,7 +383,7 @@ export class DropdownSelectButton extends React.Component<
ariaHaspopup={true}
ariaLabel={dropdownAriaLabel}
>
<Octicon symbol={OcticonSymbol.triangleDown} />
<Octicon symbol={octicons.triangleDown} />
</Button>
</div>
{this.renderSplitButtonOptions()}

View file

@ -8,7 +8,7 @@ import { RelativeTime } from '../relative-time'
import { CommitAttribution } from '../lib/commit-attribution'
import { AvatarStack } from '../lib/avatar-stack'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Draggable } from '../lib/draggable'
import { dragAndDropManager } from '../../lib/drag-and-drop-manager'
import {
@ -197,7 +197,7 @@ export class CommitListItem extends React.PureComponent<
className="unpushed-indicator"
tooltip={this.props.unpushedIndicatorTitle}
>
<Octicon symbol={OcticonSymbol.arrowUp} />
<Octicon symbol={octicons.arrowUp} />
</TooltippedContent>
)
}

View file

@ -2,7 +2,7 @@ import * as React from 'react'
import classNames from 'classnames'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { RichText } from '../lib/rich-text'
import { Repository } from '../../models/repository'
import { Commit } from '../../models/commit'
@ -247,7 +247,7 @@ export class CommitSummary extends React.Component<
const expanded = this.props.isExpanded
const onClick = expanded ? this.onCollapse : this.onExpand
const icon = expanded ? OcticonSymbol.fold : OcticonSymbol.unfold
const icon = expanded ? octicons.fold : octicons.unfold
return (
<button onClick={onClick} className="expander">
@ -393,7 +393,7 @@ export class CommitSummary extends React.Component<
onMouseOver={this.onHighlightShasNotInDiff}
onMouseOut={this.onRemoveHighlightOfShas}
>
<Octicon symbol={OcticonSymbol.info} />
<Octicon symbol={octicons.info} />
<LinkButton onClick={this.showUnreachableCommits}>
{excludedCommitsCount} unreachable {commitsPluralized}
</LinkButton>{' '}
@ -431,7 +431,7 @@ export class CommitSummary extends React.Component<
className="commit-summary-meta-item without-truncation"
aria-label="SHA"
>
<Octicon symbol={OcticonSymbol.gitCommit} />
<Octicon symbol={octicons.gitCommit} />
<TooltippedCommitSHA
className="selectable"
commit={selectedCommits[0]}
@ -559,10 +559,7 @@ export class CommitSummary extends React.Component<
<>
{filesAdded > 0 ? (
<span>
<Octicon
className="files-added-icon"
symbol={OcticonSymbol.diffAdded}
/>
<Octicon className="files-added-icon" symbol={octicons.diffAdded} />
{filesAdded} added
</span>
) : null}
@ -570,7 +567,7 @@ export class CommitSummary extends React.Component<
<span>
<Octicon
className="files-modified-icon"
symbol={OcticonSymbol.diffModified}
symbol={octicons.diffModified}
/>
{filesModified} modified
</span>
@ -579,7 +576,7 @@ export class CommitSummary extends React.Component<
<span>
<Octicon
className="files-deleted-icon"
symbol={OcticonSymbol.diffRemoved}
symbol={octicons.diffRemoved}
/>
{filesRemoved} deleted
</span>
@ -588,7 +585,7 @@ export class CommitSummary extends React.Component<
<span>
<Octicon
className="files-renamed-icon"
symbol={OcticonSymbol.diffRenamed}
symbol={octicons.diffRenamed}
/>
{filesRenamed} renamed
</span>
@ -604,7 +601,7 @@ export class CommitSummary extends React.Component<
fileCount > 0 && hasFileDescription ? filesLongDescription : undefined
}
>
<Octicon symbol={OcticonSymbol.diff} />
<Octicon symbol={octicons.diff} />
{filesShortDescription}
</TooltippedContent>
)
@ -657,7 +654,7 @@ export class CommitSummary extends React.Component<
return (
<li className="commit-summary-meta-item" title={tags.join('\n')}>
<span>
<Octicon symbol={OcticonSymbol.tag} />
<Octicon symbol={octicons.tag} />
</span>
<span className="tags selectable">{tags.join(', ')}</span>

View file

@ -1,7 +1,7 @@
import * as React from 'react'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { HighlightText } from '../lib/highlight-text'
import { Branch, IAheadBehind } from '../../models/branch'
import { IMatches } from '../../lib/fuzzy-find'
@ -108,18 +108,18 @@ export class CompareBranchListItem extends React.Component<
const { currentBranch, branch } = this.props
const { aheadBehind } = this.state
const isCurrentBranch = branch.name === currentBranch?.name
const icon = isCurrentBranch ? OcticonSymbol.check : OcticonSymbol.gitBranch
const icon = isCurrentBranch ? octicons.check : octicons.gitBranch
const aheadBehindElement = aheadBehind ? (
<div className="branch-commit-counter">
<span className="branch-commit-counter-item">
{aheadBehind.behind}
<Octicon className="icon" symbol={OcticonSymbol.arrowDown} />
<Octicon className="icon" symbol={octicons.arrowDown} />
</span>
<span className="branch-commit-counter-item">
{aheadBehind.ahead}
<Octicon className="icon" symbol={OcticonSymbol.arrowUp} />
<Octicon className="icon" symbol={octicons.arrowUp} />
</span>
</div>
) : null

View file

@ -19,7 +19,7 @@ import { IBranchListItem } from '../branches/group-branches'
import { TabBar } from '../tab-bar'
import { CompareBranchListItem } from './compare-branch-list-item'
import { FancyTextBox } from '../lib/fancy-text-box'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { SelectionSource } from '../lib/filter-list'
import { IMatches } from '../../lib/fuzzy-find'
import { Ref } from '../lib/ref'
@ -166,7 +166,7 @@ export class CompareSidebar extends React.Component<
<div className="compare-form">
<FancyTextBox
ariaLabel="Branch filter"
symbol={OcticonSymbol.gitBranch}
symbol={octicons.gitBranch}
displayClearButton={true}
placeholder={placeholderText}
onFocus={this.onTextBoxFocused}

View file

@ -2,7 +2,7 @@ import * as React from 'react'
import classNames from 'classnames'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { RichText } from '../lib/rich-text'
import { Repository } from '../../models/repository'
import { Commit } from '../../models/commit'
@ -240,9 +240,7 @@ export class ExpandableCommitSummary extends React.Component<
}
ariaControls="expandable-commit-summary"
>
<Octicon
symbol={isExpanded ? OcticonSymbol.fold : OcticonSymbol.unfold}
/>
<Octicon symbol={isExpanded ? octicons.fold : octicons.unfold} />
</Button>
)
}
@ -382,7 +380,7 @@ export class ExpandableCommitSummary extends React.Component<
onMouseOver={this.onHighlightShasNotInDiff}
onMouseOut={this.onRemoveHighlightOfShas}
>
<Octicon symbol={OcticonSymbol.info} />
<Octicon symbol={octicons.info} />
<LinkButton onClick={this.showUnreachableCommits}>
{excludedCommitsCount} unreachable {commitsPluralized}
</LinkButton>{' '}
@ -459,7 +457,7 @@ export class ExpandableCommitSummary extends React.Component<
return (
<div className="ecs-meta-item commit-ref">
<Octicon symbol={OcticonSymbol.gitCommit} />
<Octicon symbol={octicons.gitCommit} />
<div className="ref selectable">{isExpanded ? sha : shortSha}</div>
<CopyButton ariaLabel="Copy the full SHA" copyContent={sha} />
</div>
@ -569,7 +567,7 @@ export class ExpandableCommitSummary extends React.Component<
return (
<div className="ecs-meta-item lines-added-deleted">
{isExpanded ? <Octicon symbol={OcticonSymbol.diff} /> : null}
{isExpanded ? <Octicon symbol={octicons.diff} /> : null}
<div className="lines-added">
{!isExpanded ? <>+{linesAdded}</> : <>{linesAdded} added lines</>}
</div>
@ -598,7 +596,7 @@ export class ExpandableCommitSummary extends React.Component<
return (
<div className="ecs-meta-item tags selectable">
<Octicon symbol={OcticonSymbol.tag} />
<Octicon symbol={octicons.tag} />
<span>{tags.join(', ')}</span>
</div>
)

View file

@ -3,8 +3,8 @@ import classNames from 'classnames'
import { ComputedAction } from '../../models/computed-action'
import { assertNever } from '../../lib/fatal-error'
import { Octicon, OcticonSymbolType } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { Octicon, OcticonSymbol } from '../octicons'
import * as octicons from '../octicons/octicons.generated'
interface IActionStatusIconProps {
/** The status to display to the user */
@ -52,16 +52,16 @@ export class ActionStatusIcon extends React.Component<IActionStatusIconProps> {
}
}
function getSymbolForState(status: ComputedAction): OcticonSymbolType {
function getSymbolForState(status: ComputedAction): OcticonSymbol {
switch (status) {
case ComputedAction.Loading:
return OcticonSymbol.dotFill
return octicons.dotFill
case ComputedAction.Conflicts:
return OcticonSymbol.alert
return octicons.alert
case ComputedAction.Invalid:
return OcticonSymbol.x
return octicons.x
case ComputedAction.Clean:
return OcticonSymbol.check
return octicons.check
default:
return assertNever(status, `Unknown state: ${JSON.stringify(status)}`)
}

View file

@ -1,7 +1,7 @@
import * as React from 'react'
import { LinkButton } from '../lib/link-button'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Loading } from './loading'
import { Form } from './form'
import { Button } from './button'
@ -198,7 +198,7 @@ export class AuthenticationForm extends React.Component<
autoFocus={true}
>
Sign in using your browser
<Octicon symbol={OcticonSymbol.linkExternal} />
<Octicon symbol={octicons.linkExternal} />
</Button>
)
}

View file

@ -2,7 +2,7 @@ import classNames from 'classnames'
import React from 'react'
import { Author, isKnownAuthor } from '../../../models/author'
import { Octicon, syncClockwise } from '../../octicons'
import * as OcticonSymbol from '../../octicons/octicons.generated'
import * as octicons from '../../octicons/octicons.generated'
import { getFullTextForAuthor, getDisplayTextForAuthor } from './author-text'
interface IAuthorHandleProps {
@ -132,13 +132,11 @@ export class AuthorHandle extends React.Component<IAuthorHandleProps> {
{!isKnownAuthor(author) && (
<Octicon
className={classNames('icon', { spin: author.state !== 'error' })}
symbol={
author.state === 'error' ? OcticonSymbol.stop : syncClockwise
}
symbol={author.state === 'error' ? octicons.stop : syncClockwise}
/>
)}
<button onClick={this.onRemoveClick} tabIndex={-1}>
<Octicon className="delete" symbol={OcticonSymbol.x} />
<Octicon className="delete" symbol={octicons.x} />
</button>
</div>
)

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { IAvatarUser } from '../../models/avatar'
import { Octicon } from '../octicons'
import { Octicon, OcticonSymbolVariant } from '../octicons'
import { API, getDotComAPIEndpoint, getHTMLURL } from '../../lib/api'
import { TooltippedContent } from './tooltipped-content'
import { TooltipDirection } from './tooltip'
@ -182,10 +182,12 @@ interface IAvatarState {
* The octicon has been tweaked to add some padding and so that it scales nicely in
* a square aspect ratio.
*/
const DefaultAvatarSymbol = {
const DefaultAvatarSymbol: OcticonSymbolVariant = {
w: 16,
h: 16,
d: 'M13 13.145a.844.844 0 0 1-.832.855H3.834A.846.846 0 0 1 3 13.142v-.856c0-2.257 3.333-3.429 3.333-3.429s.191-.35 0-.857c-.7-.531-.786-1.363-.833-3.429C5.644 2.503 7.056 2 8 2s2.356.502 2.5 2.571C10.453 6.637 10.367 7.47 9.667 8c-.191.506 0 .857 0 .857S13 10.03 13 12.286v.859z',
p: [
'M13 13.145a.844.844 0 0 1-.832.855H3.834A.846.846 0 0 1 3 13.142v-.856c0-2.257 3.333-3.429 3.333-3.429s.191-.35 0-.857c-.7-.531-.786-1.363-.833-3.429C5.644 2.503 7.056 2 8 2s2.356.502 2.5 2.571C10.453 6.637 10.367 7.47 9.667 8c-.191.506 0 .857 0 .857S13 10.03 13 12.286v.859z',
],
}
function getEmailAvatarUrl(ep: string) {

View file

@ -3,7 +3,7 @@ import { Branch, BranchType } from '../../models/branch'
import { Row } from './row'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Ref } from './ref'
import { IStashEntry } from '../../models/stash-entry'
import { enableMoveStash } from '../../lib/feature-flag'
@ -12,7 +12,7 @@ export function renderBranchHasRemoteWarning(branch: Branch) {
if (branch.upstream != null) {
return (
<Row className="warning-helper-text">
<Octicon symbol={OcticonSymbol.alert} />
<Octicon symbol={octicons.alert} />
<p>
This branch is tracking <Ref>{branch.upstream}</Ref> and renaming this
branch will not change the branch name on the remote.
@ -39,7 +39,7 @@ export function renderBranchNameExistsOnRemoteWarning(
return (
<Row className="warning-helper-text">
<Octicon symbol={OcticonSymbol.alert} />
<Octicon symbol={octicons.alert} />
<p>
A branch named <Ref>{sanitizedName}</Ref> already exists on the remote.
</p>
@ -53,7 +53,7 @@ export function renderStashWillBeLostWarning(stash: IStashEntry | null) {
}
return (
<Row className="warning-helper-text">
<Octicon symbol={OcticonSymbol.alert} />
<Octicon symbol={octicons.alert} />
<p>
Your current stashed changes on this branch will no longer be visible in
GitHub Desktop if the branch is renamed.

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../../octicons'
import * as OcticonSymbol from '../../octicons/octicons.generated'
import * as octicons from '../../octicons/octicons.generated'
import { LinkButton } from '../link-button'
export function renderUnmergedFilesSummary(conflictedFilesCount: number) {
@ -16,7 +16,7 @@ export function renderAllResolved() {
return (
<div className="all-conflicts-resolved">
<div className="green-circle">
<Octicon symbol={OcticonSymbol.check} />
<Octicon symbol={octicons.check} />
</div>
<div className="message">All conflicts resolved</div>
</div>

View file

@ -12,7 +12,7 @@ import { Repository } from '../../../models/repository'
import { Dispatcher } from '../../dispatcher'
import { showContextualMenu } from '../../../lib/menu-item'
import { Octicon } from '../../octicons'
import * as OcticonSymbol from '../../octicons/octicons.generated'
import * as octicons from '../../octicons/octicons.generated'
import { PathText } from '../path-text'
import { ManualConflictResolution } from '../../../models/manual-conflict-resolution'
import {
@ -141,7 +141,7 @@ const renderResolvedFile: React.FunctionComponent<{
)
return (
<li key={props.path} className="unmerged-file-status-resolved">
<Octicon symbol={OcticonSymbol.fileCode} className="file-octicon" />
<Octicon symbol={octicons.fileCode} className="file-octicon" />
<div className="column-left" id={props.path}>
<PathText path={props.path} />
<div className="file-conflicts-status">{fileStatusSummary}</div>
@ -160,7 +160,7 @@ const renderResolvedFile: React.FunctionComponent<{
</Button>
)}
<div className="green-circle">
<Octicon symbol={OcticonSymbol.check} />
<Octicon symbol={octicons.check} />
</div>
</li>
)
@ -212,7 +212,7 @@ const renderManualConflictedFile: React.FunctionComponent<{
onClick={onDropdownClick}
>
Resolve
<Octicon symbol={OcticonSymbol.triangleDown} />
<Octicon symbol={octicons.triangleDown} />
</Button>
</div>
</>
@ -227,7 +227,7 @@ function renderConflictedFileWrapper(
): JSX.Element {
return (
<li key={path} className="unmerged-file-status-conflicts">
<Octicon symbol={OcticonSymbol.fileCode} className="file-octicon" />
<Octicon symbol={octicons.fileCode} className="file-octicon" />
{content}
</li>
)
@ -289,7 +289,7 @@ const renderConflictedFileWithConflictMarkers: React.FunctionComponent<{
ariaHaspopup="menu"
ariaExpanded={props.isFileResolutionOptionsMenuOpen}
>
<Octicon symbol={OcticonSymbol.triangleDown} />
<Octicon symbol={octicons.triangleDown} />
</Button>
</div>
</>

View file

@ -1,11 +1,11 @@
import * as React from 'react'
import { Octicon, OcticonSymbolType } from '../octicons'
import { Octicon, OcticonSymbol } from '../octicons'
import { TextBox, ITextBoxProps } from './text-box'
import classNames from 'classnames'
interface IFancyTextBoxProps extends ITextBoxProps {
/** Icon to render */
readonly symbol: OcticonSymbolType
readonly symbol: OcticonSymbol
/** Callback used to get a reference to internal TextBox */
readonly onRef: (textbox: TextBox) => void

View file

@ -4,7 +4,7 @@ import { LinkButton } from './link-button'
import { getDotComAPIEndpoint } from '../../lib/api'
import { isAttributableEmailFor } from '../../lib/email'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { AriaLiveContainer } from '../accessibility/aria-live-container'
interface IGitEmailNotFoundWarningProps {
@ -25,7 +25,7 @@ export class GitEmailNotFoundWarning extends React.Component<IGitEmailNotFoundWa
<span className="warning-icon"></span>
) : (
<span className="green-circle">
<Octicon className="check-icon" symbol={OcticonSymbol.check} />
<Octicon className="check-icon" symbol={octicons.check} />
</span>
)

View file

@ -1,6 +1,6 @@
import * as React from 'react'
import { Octicon } from '../../octicons'
import * as OcticonSymbol from '../../octicons/octicons.generated'
import * as octicons from '../../octicons/octicons.generated'
import classNames from 'classnames'
import { AriaLiveContainer } from '../../accessibility/aria-live-container'
import { assertNever } from '../../../lib/fatal-error'
@ -85,9 +85,9 @@ export class InputDescription extends React.Component<IInputDescriptionProps> {
case InputDescriptionType.Caption:
return null
case InputDescriptionType.Warning:
return <Octicon symbol={OcticonSymbol.alert} />
return <Octicon symbol={octicons.alert} />
case InputDescriptionType.Error:
return <Octicon symbol={OcticonSymbol.stop} />
return <Octicon symbol={octicons.stop} />
default:
return assertNever(type, `Unknown input type ${type}`)
}

View file

@ -2,7 +2,7 @@ import * as React from 'react'
import { ITextBoxProps, TextBox } from './text-box'
import { Button } from './button'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
interface IPasswordTextBoxState {
/**
@ -32,8 +32,8 @@ export class PasswordTextBox extends React.Component<
public render() {
const buttonIcon = this.state.showPassword
? OcticonSymbol.eye
: OcticonSymbol.eyeClosed
? octicons.eye
: octicons.eyeClosed
const type = this.state.showPassword ? 'text' : 'password'
const props: ITextBoxProps = { ...this.props, ...{ type } }
return (

View file

@ -2,7 +2,7 @@ import * as React from 'react'
import { AppFileStatus, AppFileStatusKind } from '../../models/status'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { PathText } from './path-text'
interface IPathLabelProps {
@ -46,7 +46,7 @@ export class PathLabel extends React.Component<IPathLabelProps, {}> {
return (
<span {...props} aria-hidden={this.props.ariaHidden}>
<PathText path={status.oldPath} availableWidth={segmentWidth} />
<Octicon className="rename-arrow" symbol={OcticonSymbol.arrowRight} />
<Octicon className="rename-arrow" symbol={octicons.arrowRight} />
<PathText path={this.props.path} availableWidth={segmentWidth} />
</span>
)

View file

@ -2,7 +2,7 @@ import * as React from 'react'
import { Button } from './button'
import { Popover, PopoverAnchorPosition, PopoverDecoration } from './popover'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import classNames from 'classnames'
const maxPopoverContentHeight = 500
@ -74,7 +74,7 @@ export class PopoverDropdown extends React.Component<
onClick={this.closePopover}
aria-label="Close"
>
<Octicon symbol={OcticonSymbol.x} />
<Octicon symbol={octicons.x} />
</button>
</div>
<div className="popover-dropdown-content">{this.props.children}</div>
@ -95,7 +95,7 @@ export class PopoverDropdown extends React.Component<
>
<span className="popover-dropdown-button-label">{label}</span>
<span className="button-content">{buttonContent}</span>
<Octicon symbol={OcticonSymbol.triangleDown} />
<Octicon symbol={octicons.triangleDown} />
</Button>
{this.renderPopover()}
</div>

View file

@ -3,7 +3,7 @@ import classNames from 'classnames'
import { createUniqueId, releaseUniqueId } from './id-pool'
import { showContextualMenu } from '../../lib/menu-item'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { AriaLiveContainer } from '../accessibility/aria-live-container'
export interface ITextBoxProps {
@ -328,7 +328,7 @@ export class TextBox extends React.Component<ITextBoxProps, ITextBoxState> {
aria-label="Clear"
onClick={this.clearSearchText}
>
<Octicon symbol={OcticonSymbol.x} />
<Octicon symbol={octicons.x} />
</button>
)}
{this.state.valueCleared && (

View file

@ -3,7 +3,7 @@ import { formatRebaseValue } from '../../../lib/rebase'
import { RichText } from '../../lib/rich-text'
import { Dialog, DialogContent } from '../../dialog'
import { Octicon } from '../../octicons'
import * as OcticonSymbol from '../../octicons/octicons.generated'
import * as octicons from '../../octicons/octicons.generated'
import { IMultiCommitOperationProgress } from '../../../models/progress'
interface IProgressDialogProps {
@ -39,7 +39,7 @@ export class ProgressDialog extends React.Component<IProgressDialogProps> {
<div className="details">
<div className="green-circle">
<Octicon symbol={OcticonSymbol.check} />
<Octicon symbol={octicons.check} />
</div>
<div className="summary">
<div className="message">

View file

@ -1,8 +1,8 @@
import * as React from 'react'
import { UiView } from '../ui-view'
import { Button } from '../lib/button'
import { Octicon, OcticonSymbolType } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { Octicon, OcticonSymbol } from '../octicons'
import * as octicons from '../octicons/octicons.generated'
import {
WelcomeLeftTopImageUri,
WelcomeLeftBottomImageUri,
@ -351,7 +351,7 @@ export class NoRepositoriesView extends React.Component<
private onShowClone = () => this.props.onClone()
private renderButtonGroupButton(
symbol: OcticonSymbolType,
symbol: OcticonSymbol,
title: string,
onClick: () => void,
type?: 'submit',
@ -375,7 +375,7 @@ export class NoRepositoriesView extends React.Component<
if (this.props.tutorialPaused) {
return this.renderButtonGroupButton(
OcticonSymbol.mortarBoard,
octicons.mortarBoard,
__DARWIN__
? 'Return to In Progress Tutorial'
: 'Return to in progress tutorial',
@ -384,7 +384,7 @@ export class NoRepositoriesView extends React.Component<
)
} else {
return this.renderButtonGroupButton(
OcticonSymbol.mortarBoard,
octicons.mortarBoard,
__DARWIN__
? 'Create a Tutorial Repository…'
: 'Create a tutorial repository…',
@ -396,7 +396,7 @@ export class NoRepositoriesView extends React.Component<
private renderCloneButton() {
return this.renderButtonGroupButton(
OcticonSymbol.repoClone,
octicons.repoClone,
__DARWIN__
? 'Clone a Repository from the Internet…'
: 'Clone a repository from the Internet…',
@ -408,7 +408,7 @@ export class NoRepositoriesView extends React.Component<
private renderCreateRepositoryButton() {
return this.renderButtonGroupButton(
OcticonSymbol.plus,
octicons.plus,
__DARWIN__
? 'Create a New Repository on your Local Drive…'
: 'Create a New Repository on your local drive…',
@ -418,7 +418,7 @@ export class NoRepositoriesView extends React.Component<
private renderAddExistingRepositoryButton() {
return this.renderButtonGroupButton(
OcticonSymbol.fileDirectory,
octicons.fileDirectory,
__DARWIN__
? 'Add an Existing Repository from your Local Drive…'
: 'Add an Existing Repository from your local drive…',
@ -437,7 +437,7 @@ export class NoRepositoriesView extends React.Component<
</div>
<div className="drag-drop-info">
<Octicon symbol={OcticonSymbol.lightBulb} />
<Octicon symbol={octicons.lightBulb} />
<div>
<strong>ProTip!</strong> You can drag &amp; drop an existing
repository folder here to add it to Desktop

View file

@ -15,7 +15,7 @@ import {
import { Account } from '../../models/account'
import { API, IAPIWorkflowJobStep } from '../../lib/api'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { RepositoryWithGitHubRepository } from '../../models/repository'
import { CICheckRunActionsJobStepList } from '../check-runs/ci-check-run-actions-job-step-list'
import { LinkButton } from '../lib/link-button'
@ -101,7 +101,7 @@ export class PullRequestChecksFailed extends React.Component<
const header = (
<div className="ci-check-run-dialog-header">
<Octicon symbol={OcticonSymbol.xCircleFill} />
<Octicon symbol={octicons.xCircleFill} />
<div className="title-container">
<div className="summary">
{failedChecks.length} {pluralChecks} failed in your pull request

View file

@ -2,9 +2,8 @@ import * as React from 'react'
import { Dialog, DialogContent, DialogFooter } from '../dialog'
import { PullRequest } from '../../models/pull-request'
import { Dispatcher } from '../dispatcher'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { OcticonSymbolType } from '../octicons/octicons.generated'
import { Octicon, OcticonSymbol } from '../octicons'
import * as octicons from '../octicons/octicons.generated'
import { RepositoryWithGitHubRepository } from '../../models/repository'
import { SandboxedMarkdown } from '../lib/sandboxed-markdown'
import { LinkButton } from '../lib/link-button'
@ -22,7 +21,7 @@ interface IPullRequestCommentLikeProps {
readonly pullRequest: PullRequest
readonly eventDate: Date
readonly eventVerb: string
readonly eventIconSymbol: OcticonSymbolType
readonly eventIconSymbol: OcticonSymbol
readonly eventIconClass: string
readonly externalURL: string
readonly user: IAPIIdentity
@ -190,8 +189,8 @@ export abstract class PullRequestCommentLike extends React.Component<IPullReques
className={cls}
symbol={
pullRequest.draft
? OcticonSymbol.gitPullRequestDraft
: OcticonSymbol.gitPullRequest
? octicons.gitPullRequestDraft
: octicons.gitPullRequest
}
/>
)

View file

@ -2,8 +2,8 @@ import {
ValidNotificationPullRequestReview,
ValidNotificationPullRequestReviewState,
} from '../../lib/valid-notification-pull-request-review'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { OcticonSymbolType } from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { OcticonSymbol } from '../octicons'
/** Returns the user-facing verb for a given review's state. */
export function getVerbForPullRequestReview(
@ -20,7 +20,7 @@ export function getVerbForPullRequestReview(
}
type ReviewStateIcon = {
symbol: OcticonSymbolType
symbol: OcticonSymbol
className: string
}
@ -31,17 +31,17 @@ export function getPullRequestReviewStateIcon(
switch (state) {
case 'APPROVED':
return {
symbol: OcticonSymbol.check,
symbol: octicons.check,
className: 'pr-review-approved',
}
case 'CHANGES_REQUESTED':
return {
symbol: OcticonSymbol.fileDiff,
symbol: octicons.fileDiff,
className: 'pr-review-changes-requested',
}
case 'COMMENTED':
return {
symbol: OcticonSymbol.eye,
symbol: octicons.eye,
className: 'pr-review-commented',
}
}

View file

@ -1,12 +1,13 @@
import { OcticonSymbolType } from './octicons.generated'
import { OcticonSymbolVariant } from '.'
/**
* An check mark produced by Gavin that is scaled for 12x12 as opposed to the
* regular 16x16 and is thicker for better visibility.
*/
export const diffCheck: OcticonSymbolType = {
export const diffCheck: OcticonSymbolVariant = {
w: 12,
h: 12,
d: 'M10.5303 2.96967C10.8232 3.26256 10.8232 3.73744 10.5303 4.03033L5.03033 9.53033C4.73744 9.82322 4.26256 9.82322 3.96967 9.53033L1.46967 7.03033C1.17678 6.73744 1.17678 6.26256 1.46967 5.96967C1.76256 5.67678 2.23744 5.67678 2.53033 5.96967L4.5 7.93934L9.46967 2.96967C9.76256 2.67678 10.2374 2.67678 10.5303 2.96967Z',
fr: 'evenodd',
p: [
'M10.5303 2.96967C10.8232 3.26256 10.8232 3.73744 10.5303 4.03033L5.03033 9.53033C4.73744 9.82322 4.26256 9.82322 3.96967 9.53033L1.46967 7.03033C1.17678 6.73744 1.17678 6.26256 1.46967 5.96967C1.76256 5.67678 2.23744 5.67678 2.53033 5.96967L4.5 7.93934L9.46967 2.96967C9.76256 2.67678 10.2374 2.67678 10.5303 2.96967Z',
],
}

View file

@ -1,4 +1,4 @@
export { OcticonSymbolType } from './octicons.generated'
export * from './octicons.generated'
export { Octicon } from './octicon'
export { iconForRepository } from './repository'
export { iconForStatus } from './status'

View file

@ -1,5 +1,5 @@
import * as React from 'react'
import { OcticonSymbolType } from './octicons.generated'
import { OcticonSymbol, OcticonSymbolVariant } from '.'
import classNames from 'classnames'
import ReactDOM from 'react-dom'
import { createObservableRef } from '../lib/observable-ref'
@ -7,11 +7,11 @@ import { Tooltip, TooltipDirection } from '../lib/tooltip'
interface IOcticonProps {
/**
* An instance of an object conforming to the OcticonSymbol
* type. Supports custom paths as well as those provided
* through the static properties of the OcticonSymbol class.
* An instance of an object conforming to the OcticonSymbol type. Supports
* custom paths as well as those provided through the static properties of
* the OcticonSymbol class.
*/
readonly symbol: OcticonSymbolType
readonly symbol: OcticonSymbol
/**
* An optional classname that will be appended to the default
@ -25,6 +25,8 @@ interface IOcticonProps {
readonly title?: string
readonly tooltipDirection?: TooltipDirection
readonly height?: number
}
/**
@ -34,14 +36,40 @@ interface IOcticonProps {
* which is why the width and height properties specify the maximum and
* not the minimum size.
*
* Usage: `<Octicon symbol={OcticonSymbol.mark_github} />`
* Usage: `<Octicon symbol={octicons.markGithub} />`
*/
export class Octicon extends React.Component<IOcticonProps, {}> {
private svgRef = createObservableRef<SVGSVGElement>()
public render() {
const { symbol, title, tooltipDirection } = this.props
const viewBox = `0 0 ${symbol.w} ${symbol.h}`
const { symbol } = this.props
if (this.isSingleVariant(symbol)) {
return this.renderIcon(symbol.p, symbol.h, symbol.w)
} else {
const height = this.props.height ?? 16
const naturalHeight = this.closestNaturalHeight(
Object.keys(symbol).map(h => parseInt(h, 10)) as Array<number>,
height
)
const scaledSymbol = symbol[naturalHeight]
if (scaledSymbol === undefined) {
// Should never happen, but if it does the app should still be usable
return null
}
const naturalWidth = scaledSymbol.w
const width = height * (naturalWidth / naturalHeight)
return this.renderIcon(scaledSymbol.p, height, width)
}
}
private renderIcon(paths: string[], height: number, width: number) {
const { title, tooltipDirection } = this.props
const viewBox = `0 0 ${width} ${height}`
const className = classNames('octicon', this.props.className)
// Hide the octicon from screen readers when it's only being used
@ -62,16 +90,53 @@ export class Octicon extends React.Component<IOcticonProps, {}> {
viewBox={viewBox}
ref={this.svgRef}
tabIndex={-1}
height={height}
width={width}
>
{title !== undefined && (
<Tooltip target={this.svgRef} direction={direction}>
{title}
</Tooltip>
)}
<path fillRule={symbol.fr} d={symbol.d} />
{paths.map((d, i) => (
<path key={i} d={d} />
))}
</svg>
)
}
/**
* Determine if the given symbol is a single variant or a set of variants.
*
* @param symbol The symbol to check.
* @returns True if the symbol is a single variant, false if it's a set.
*/
private isSingleVariant(
symbol: OcticonSymbol
): symbol is OcticonSymbolVariant {
return (
symbol instanceof Object &&
symbol.hasOwnProperty('p') &&
symbol.hasOwnProperty('h') &&
symbol.hasOwnProperty('w')
)
}
/**
* Find the closest natural height to the given height. Falls back to the
* first height in the list if none are larger or equal than the given height.
*
* @param naturalHeights The list of natural heights to choose from.
* @param height The height to find the closest natural height to.
* @returns The closest natural height to the given height.
*/
private closestNaturalHeight(naturalHeights: Array<number>, height: number) {
return naturalHeights.reduce(
(acc, naturalHeight) => (naturalHeight <= height ? naturalHeight : acc),
naturalHeights[0]
)
}
}
/**
@ -82,7 +147,7 @@ export class Octicon extends React.Component<IOcticonProps, {}> {
* @param id Optional identifier to set to the wrapper element.
*/
export function createOcticonElement(
symbol: OcticonSymbolType,
symbol: OcticonSymbol,
className?: string,
id?: string
) {

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Repository } from '../../models/repository'
import { CloningRepository } from '../../models/cloning-repository'
@ -7,24 +7,24 @@ import { CloningRepository } from '../../models/cloning-repository'
*/
export function iconForRepository(repository: Repository | CloningRepository) {
if (repository instanceof CloningRepository) {
return OcticonSymbol.desktopDownload
return octicons.desktopDownload
}
if (repository.missing) {
return OcticonSymbol.alert
return octicons.alert
}
const gitHubRepo = repository.gitHubRepository
if (!gitHubRepo) {
return OcticonSymbol.deviceDesktop
return octicons.deviceDesktop
}
if (gitHubRepo.isPrivate) {
return OcticonSymbol.lock
return octicons.lock
}
if (gitHubRepo.fork) {
return OcticonSymbol.repoForked
return octicons.repoForked
}
return OcticonSymbol.repo
return octicons.repo
}

View file

@ -3,8 +3,8 @@ import {
AppFileStatus,
isConflictWithMarkers,
} from '../../models/status'
import * as OcticonSymbol from './octicons.generated'
import { OcticonSymbolType } from '../octicons'
import * as octicons from './octicons.generated'
import { OcticonSymbol } from '../octicons'
import { assertNever } from '../../lib/fatal-error'
/**
@ -13,25 +13,25 @@ import { assertNever } from '../../lib/fatal-error'
*
* Used in file lists.
*/
export function iconForStatus(status: AppFileStatus): OcticonSymbolType {
export function iconForStatus(status: AppFileStatus): OcticonSymbol {
switch (status.kind) {
case AppFileStatusKind.New:
case AppFileStatusKind.Untracked:
return OcticonSymbol.diffAdded
return octicons.diffAdded
case AppFileStatusKind.Modified:
return OcticonSymbol.diffModified
return octicons.diffModified
case AppFileStatusKind.Deleted:
return OcticonSymbol.diffRemoved
return octicons.diffRemoved
case AppFileStatusKind.Renamed:
return OcticonSymbol.diffRenamed
return octicons.diffRenamed
case AppFileStatusKind.Conflicted:
if (isConflictWithMarkers(status)) {
const conflictsCount = status.conflictMarkerCount
return conflictsCount > 0 ? OcticonSymbol.alert : OcticonSymbol.check
return conflictsCount > 0 ? octicons.alert : octicons.check
}
return OcticonSymbol.alert
return octicons.alert
case AppFileStatusKind.Copied:
return OcticonSymbol.diffAdded
return octicons.diffAdded
default:
return assertNever(status, `Unknown file status ${status}`)
}

View file

@ -1,17 +1,17 @@
import { OcticonSymbolType } from './octicons.generated'
import { OcticonSymbolVariant } from '.'
/**
* An horizontally flipped (i.e `scaleX(-1)`) but otherwise unmodified version of
* the `sync` octicon.
*/
export const syncClockwise: OcticonSymbolType = {
export const syncClockwise: OcticonSymbolVariant = {
w: 16,
h: 16,
d:
p: [
'M8 2.5c1.645 0 3.123.722 4.131 1.869l-1.204 1.204a.25.25 0 0 0 .177.427h3.646a.25.25 ' +
'0 0 0 .25-.25V2.104a.25.25 0 0 0-.427-.177l-1.38 1.38A7.001 7.001 0 0 0 1.05 7.16a.75.75 ' +
'0 1 0 1.49.178A5.501 5.501 0 0 1 8 2.5zm6.294 5.505a.75.75 0 0 0-.833.656 5.501 5.501 ' +
'0 0 1-9.592 2.97l1.204-1.204A.25.25 0 0 0 4.896 10H1.25a.25.25 0 0 0-.25.25v3.646c0 ' +
'.223.27.335.427.177l1.38-1.38A7.001 7.001 0 0 0 14.95 8.84a.75.75 0 0 0-.657-.834z',
fr: 'evenodd',
'0 0 0 .25-.25V2.104a.25.25 0 0 0-.427-.177l-1.38 1.38A7.001 7.001 0 0 0 1.05 7.16a.75.75 ' +
'0 1 0 1.49.178A5.501 5.501 0 0 1 8 2.5zm6.294 5.505a.75.75 0 0 0-.833.656 5.501 5.501 ' +
'0 0 1-9.592 2.97l1.204-1.204A.25.25 0 0 0 4.896 10H1.25a.25.25 0 0 0-.25.25v3.646c0 ' +
'.223.27.335.427.177l1.38-1.38A7.001 7.001 0 0 0 14.95 8.84a.75.75 0 0 0-.657-.834z',
],
}

View file

@ -8,7 +8,7 @@ import { DialogFooter, OkCancelButtonGroup, Dialog } from '../dialog'
import { Dispatcher } from '../dispatcher'
import { Ref } from '../lib/ref'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { OpenPullRequestDialogHeader } from './open-pull-request-header'
import { PullRequestFilesChanged } from './pull-request-files-changed'
import { PullRequestMergeStatus } from './pull-request-merge-status'
@ -207,7 +207,7 @@ export class OpenPullRequestDialog extends React.Component<IOpenPullRequestDialo
return (
<div className="open-pull-request-message">
<div>
<Octicon symbol={OcticonSymbol.gitPullRequest} />
<Octicon symbol={octicons.gitPullRequest} />
<h3>There are no changes.</h3>
{message}
</div>
@ -225,7 +225,7 @@ export class OpenPullRequestDialog extends React.Component<IOpenPullRequestDialo
return (
<div className="open-pull-request-message">
<div>
<Octicon symbol={OcticonSymbol.gitPullRequest} />
<Octicon symbol={octicons.gitPullRequest} />
<h3>Could not find a default branch to compare against.</h3>
Select a base branch above.
</div>
@ -249,7 +249,7 @@ export class OpenPullRequestDialog extends React.Component<IOpenPullRequestDialo
const okButton = (
<>
{currentBranchHasPullRequest && (
<Octicon symbol={OcticonSymbol.linkExternal} />
<Octicon symbol={octicons.linkExternal} />
)}
{__DARWIN__
? `${viewCreate} Pull Request`

View file

@ -3,7 +3,7 @@ import { assertNever } from '../../lib/fatal-error'
import { ComputedAction } from '../../models/computed-action'
import { MergeTreeResult } from '../../models/merge'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
interface IPullRequestMergeStatusProps {
/** The result of merging the pull request branch into the base branch */
@ -39,7 +39,7 @@ export class PullRequestMergeStatus extends React.Component<IPullRequestMergeSta
return (
<span className="pr-merge-status-clean">
<strong>
<Octicon symbol={OcticonSymbol.check} /> Able to merge.
<Octicon symbol={octicons.check} /> Able to merge.
</strong>{' '}
These branches can be automatically merged.
</span>
@ -48,7 +48,7 @@ export class PullRequestMergeStatus extends React.Component<IPullRequestMergeSta
return (
<span className="pr-merge-status-conflicts">
<strong>
<Octicon symbol={OcticonSymbol.x} /> Can't automatically merge.
<Octicon symbol={octicons.x} /> Can't automatically merge.
</strong>{' '}
Dont worry, you can still create the pull request.
</span>

View file

@ -29,7 +29,7 @@ import {
defaultUncommittedChangesStrategy,
} from '../../models/uncommitted-changes-strategy'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import {
isConfigFileLockError,
parseConfigLockFilePathFromError,
@ -236,31 +236,31 @@ export class Preferences extends React.Component<
type={TabBarType.Vertical}
>
<span>
<Octicon className="icon" symbol={OcticonSymbol.home} />
<Octicon className="icon" symbol={octicons.home} />
Accounts
</span>
<span>
<Octicon className="icon" symbol={OcticonSymbol.person} />
<Octicon className="icon" symbol={octicons.person} />
Integrations
</span>
<span>
<Octicon className="icon" symbol={OcticonSymbol.gitCommit} />
<Octicon className="icon" symbol={octicons.gitCommit} />
Git
</span>
<span>
<Octicon className="icon" symbol={OcticonSymbol.paintbrush} />
<Octicon className="icon" symbol={octicons.paintbrush} />
Appearance
</span>
<span>
<Octicon className="icon" symbol={OcticonSymbol.bell} />
<Octicon className="icon" symbol={octicons.bell} />
Notifications
</span>
<span>
<Octicon className="icon" symbol={OcticonSymbol.question} />
<Octicon className="icon" symbol={octicons.question} />
Prompts
</span>
<span>
<Octicon className="icon" symbol={OcticonSymbol.settings} />
<Octicon className="icon" symbol={octicons.gear} />
Advanced
</span>
</TabBar>

View file

@ -9,7 +9,7 @@ import { merge } from '../../lib/merge'
import { caseInsensitiveCompare } from '../../lib/compare'
import { sanitizedRepositoryName } from '../add-repository/sanitized-repository-name'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { RepositoryPublicationSettings } from '../../models/publish-settings'
interface IPublishRepositoryProps {
@ -184,7 +184,7 @@ export class PublishRepository extends React.Component<
return (
<Row className="warning-helper-text">
<Octicon symbol={OcticonSymbol.alert} />
<Octicon symbol={octicons.alert} />
Will be created as {sanitizedName}
</Row>
)

View file

@ -6,7 +6,7 @@ import { Dispatcher } from './dispatcher'
import { Button } from './lib/button'
import { SandboxedMarkdown } from './lib/sandboxed-markdown'
import { Octicon } from './octicons'
import * as OcticonSymbol from './octicons/octicons.generated'
import * as octicons from './octicons/octicons.generated'
import classNames from 'classnames'
/**
@ -158,11 +158,11 @@ export class PullRequestQuickView extends React.Component<
private renderHeader = (): JSX.Element => {
return (
<header className="header">
<Octicon symbol={OcticonSymbol.listUnordered} />
<Octicon symbol={octicons.listUnordered} />
<div className="action-needed">Review requested</div>
<Button className="button-with-icon" onClick={this.onViewOnGitHub}>
View on GitHub
<Octicon symbol={OcticonSymbol.linkExternal} />
<Octicon symbol={octicons.linkExternal} />
</Button>
</header>
)
@ -174,9 +174,7 @@ export class PullRequestQuickView extends React.Component<
<Octicon
className="icon"
symbol={
isDraft
? OcticonSymbol.gitPullRequestDraft
: OcticonSymbol.gitPullRequest
isDraft ? octicons.gitPullRequestDraft : octicons.gitPullRequest
}
/>
<span className="state">{isDraft ? 'Draft' : 'Open'}</span>

View file

@ -15,7 +15,7 @@ import { ILocalRepositoryState, Repository } from '../../models/repository'
import { Dispatcher } from '../dispatcher'
import { Button } from '../lib/button'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { showContextualMenu } from '../../lib/menu-item'
import { IMenuItem } from '../../lib/menu-item'
import { PopupType } from '../../models/popup'
@ -282,7 +282,7 @@ export class RepositoriesList extends React.Component<
ariaExpanded={this.state.newRepositoryMenuExpanded}
>
Add
<Octicon symbol={OcticonSymbol.triangleDown} />
<Octicon symbol={octicons.triangleDown} />
</Button>
)
}

View file

@ -2,7 +2,7 @@ import * as React from 'react'
import { Repository } from '../../models/repository'
import { Octicon, iconForRepository } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Repositoryish } from './group-repositories'
import { HighlightText } from '../lib/highlight-text'
import { IMatches } from '../../lib/fuzzy-find'
@ -141,8 +141,8 @@ const renderAheadBehindIndicator = (aheadBehind: IAheadBehind) => {
tagName="div"
tooltip={aheadBehindTooltip}
>
{ahead > 0 && <Octicon symbol={OcticonSymbol.arrowUp} />}
{behind > 0 && <Octicon symbol={OcticonSymbol.arrowDown} />}
{ahead > 0 && <Octicon symbol={octicons.arrowUp} />}
{behind > 0 && <Octicon symbol={octicons.arrowDown} />}
</TooltippedContent>
)
}
@ -153,7 +153,7 @@ const renderChangesIndicator = () => {
className="change-indicator-wrapper"
tooltip="There are uncommitted changes in this repository"
>
<Octicon symbol={OcticonSymbol.dotFill} />
<Octicon symbol={octicons.dotFill} />
</TooltippedContent>
)
}

View file

@ -30,7 +30,7 @@ import {
} from '../lib/identifier-rules'
import { Account } from '../../models/account'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
interface IRepositorySettingsProps {
readonly initialSelectedTab?: RepositorySettingsTab
@ -184,20 +184,20 @@ export class RepositorySettings extends React.Component<
type={TabBarType.Vertical}
>
<span>
<Octicon className="icon" symbol={OcticonSymbol.server} />
<Octicon className="icon" symbol={octicons.server} />
Remote
</span>
<span>
<Octicon className="icon" symbol={OcticonSymbol.file} />
<Octicon className="icon" symbol={octicons.file} />
{__DARWIN__ ? 'Ignored Files' : 'Ignored files'}
</span>
<span>
<Octicon className="icon" symbol={OcticonSymbol.gitCommit} />
<Octicon className="icon" symbol={octicons.gitCommit} />
{__DARWIN__ ? 'Git Config' : 'Git config'}
</span>
{showForkSettings && (
<span>
<Octicon className="icon" symbol={OcticonSymbol.repoForked} />
<Octicon className="icon" symbol={octicons.repoForked} />
{__DARWIN__ ? 'Fork Behavior' : 'Fork behavior'}
</span>
)}

View file

@ -10,7 +10,7 @@ import {
import { assertNever } from '../../lib/fatal-error'
import { LinkButton } from '../lib/link-button'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Row } from '../lib/row'
import { TextBox } from '../lib/text-box'
import { Dialog, DialogError, DialogContent, DialogFooter } from '../dialog'
@ -236,7 +236,7 @@ export class SignIn extends React.Component<ISignInProps, ISignInState> {
disabled={disableSubmit}
>
Sign in using your browser
<Octicon symbol={OcticonSymbol.linkExternal} />
<Octicon symbol={octicons.linkExternal} />
</Button>
</Row>

View file

@ -7,7 +7,7 @@ import { Row } from '../lib/row'
import { Branch } from '../../models/branch'
import { UncommittedChangesStrategy } from '../../models/uncommitted-changes-strategy'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { PopupType } from '../../models/popup'
import { startTimer } from '../lib/timing'
import { OkCancelButtonGroup } from '../dialog/ok-cancel-button-group'
@ -88,7 +88,7 @@ export class StashAndSwitchBranch extends React.Component<
return (
<Row>
<Octicon symbol={OcticonSymbol.alert} /> Your current stash will be
<Octicon symbol={octicons.alert} /> Your current stash will be
overwritten by creating a new stash
</Row>
)

View file

@ -23,7 +23,7 @@ import { SectionList } from '../lib/list/section-list'
import { Loading } from '../lib/loading'
import { getPullRequestReviewStateIcon } from '../notifications/pull-request-review-helpers'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import {
getNotificationSettingsUrl,
getNotificationsPermission,
@ -133,7 +133,7 @@ class TestNotificationItemRowContent extends React.Component<{
{html_url && (
<div className="right-accessory">
<Button onClick={this.onExternalLinkClick}>
<Octicon symbol={OcticonSymbol.linkExternal} />
<Octicon symbol={octicons.linkExternal} />
</Button>
</div>
)}
@ -724,8 +724,8 @@ export class TestNotifications extends React.Component<
className={pullRequest.draft ? 'pr-draft-icon' : 'pr-icon'}
symbol={
pullRequest.draft
? OcticonSymbol.gitPullRequestDraft
: OcticonSymbol.gitPullRequest
? octicons.gitPullRequestDraft
: octicons.gitPullRequest
}
/>
)

View file

@ -1,7 +1,7 @@
import * as React from 'react'
import { Dispatcher } from '../dispatcher'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { syncClockwise } from '../octicons'
import * as octicons from '../octicons/octicons.generated'
import { OcticonSymbol, syncClockwise } from '../octicons'
import { Repository } from '../../models/repository'
import { TipState } from '../../models/tip'
import { ToolbarDropdown, DropdownState } from './dropdown'
@ -122,7 +122,7 @@ export class BranchDropdown extends React.Component<IBranchDropdownProps> {
const tipKind = tip.kind
let icon: OcticonSymbol.OcticonSymbolType = OcticonSymbol.gitBranch
let icon: OcticonSymbol = octicons.gitBranch
let iconClassName: string | undefined = undefined
let title: string
let description = __DARWIN__ ? 'Current Branch' : 'Current branch'
@ -131,7 +131,7 @@ export class BranchDropdown extends React.Component<IBranchDropdownProps> {
let tooltip: string
if (this.props.currentPullRequest) {
icon = OcticonSymbol.gitPullRequest
icon = octicons.gitPullRequest
}
if (tip.kind === TipState.Unknown) {
@ -146,7 +146,7 @@ export class BranchDropdown extends React.Component<IBranchDropdownProps> {
} else if (tip.kind === TipState.Detached) {
title = `On ${tip.currentSha.substring(0, 7)}`
tooltip = 'Currently on a detached HEAD'
icon = OcticonSymbol.gitCommit
icon = octicons.gitCommit
description = 'Detached HEAD'
} else if (tip.kind === TipState.Valid) {
title = tooltip = tip.branch.name
@ -173,7 +173,7 @@ export class BranchDropdown extends React.Component<IBranchDropdownProps> {
} else if (conflictState !== null && isRebaseConflictState(conflictState)) {
title = conflictState.targetBranch
description = 'Rebasing branch'
icon = OcticonSymbol.gitBranch
icon = octicons.gitBranch
canOpen = false
disabled = true
tooltip = `Rebasing ${conflictState.targetBranch}`

View file

@ -1,6 +1,6 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
import * as React from 'react'
import { Octicon, OcticonSymbolType } from '../octicons'
import { Octicon, OcticonSymbol } from '../octicons'
import classNames from 'classnames'
import { assertNever } from '../../lib/fatal-error'
import { Button } from '../lib/button'
@ -29,7 +29,7 @@ export interface IToolbarButtonProps {
readonly tooltip?: string
/** An optional symbol to be displayed next to the button text */
readonly icon?: OcticonSymbolType
readonly icon?: OcticonSymbol
/** The class name for the icon element. */
readonly iconClassName?: string

View file

@ -1,8 +1,8 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
import * as React from 'react'
import { Octicon, OcticonSymbolType } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { Octicon, OcticonSymbol } from '../octicons'
import * as octicons from '../octicons/octicons.generated'
import { assertNever } from '../../lib/fatal-error'
import { ToolbarButton, ToolbarButtonStyle } from './button'
import { rectEquals } from '../lib/rect'
@ -44,7 +44,7 @@ export interface IToolbarDropdownProps {
readonly tooltip?: string
/** An optional symbol to be displayed next to the button text */
readonly icon?: OcticonSymbolType
readonly icon?: OcticonSymbol
/**
* The state for of the drop down button.
@ -251,13 +251,13 @@ export class ToolbarDropdown extends React.Component<
return this.props.dropdownState === 'open'
}
private dropdownIcon(state: DropdownState): OcticonSymbolType {
private dropdownIcon(state: DropdownState): OcticonSymbol {
// @TODO: Remake triangle octicon in a 12px version,
// right now it's scaled badly on normal dpi monitors.
if (state === 'open') {
return OcticonSymbol.triangleUp
return octicons.triangleUp
} else if (state === 'closed') {
return OcticonSymbol.triangleDown
return octicons.triangleDown
} else {
return assertNever(state, `Unknown dropdown state ${state}`)
}

View file

@ -7,8 +7,13 @@ import { TipState } from '../../models/tip'
import { FetchType } from '../../models/fetch'
import { Dispatcher } from '../dispatcher'
import { Octicon, syncClockwise } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import {
Octicon,
OcticonSymbol,
OcticonSymbolVariant,
syncClockwise,
} from '../octicons'
import * as octicons from '../octicons/octicons.generated'
import { RelativeTime } from '../relative-time'
import { ToolbarButton, ToolbarButtonStyle } from './button'
@ -115,7 +120,7 @@ export type DropdownItem = {
readonly title: string
readonly description: string | JSX.Element
readonly action: () => void
readonly icon: OcticonSymbol.OcticonSymbolType
readonly icon: OcticonSymbol
}
function renderAheadBehind(aheadBehind: IAheadBehind, numTagsToPush: number) {
@ -129,7 +134,7 @@ function renderAheadBehind(aheadBehind: IAheadBehind, numTagsToPush: number) {
content.push(
<span key="ahead">
{ahead + numTagsToPush}
<Octicon symbol={OcticonSymbol.arrowUp} />
<Octicon symbol={octicons.arrowUp} />
</span>
)
}
@ -138,7 +143,7 @@ function renderAheadBehind(aheadBehind: IAheadBehind, numTagsToPush: number) {
content.push(
<span key="behind">
{behind}
<Octicon symbol={OcticonSymbol.arrowDown} />
<Octicon symbol={octicons.arrowDown} />
</span>
)
}
@ -162,15 +167,15 @@ function renderLastFetched(lastFetched: Date | null): JSX.Element | string {
* This represents the "double arrow" icon used to show a force-push, and is a
* less complicated icon than the generated Octicon from the `octicons` package.
*/
export const forcePushIcon: OcticonSymbol.OcticonSymbolType = {
export const forcePushIcon: OcticonSymbolVariant = {
w: 10,
h: 16,
d:
p: [
'M0 6a.75.75 0 0 0 .974.714L4.469 3.22a.75.75 0 0 1 1.06 0l3.478 3.478a.75.75 ' +
'0 0 0 .772-1.228L5.53 1.22a.75.75 0 0 0-1.06 0L.22 5.47A.75.75 0 0 0 0 6zm0 ' +
'3a.75.75 0 0 0 1.28.53l2.97-2.97V14a.75.75 0 1 0 1.5 0V6.56l2.97 2.97a.75.75 ' +
'0 0 0 1.06-1.06L5.53 4.22a.75.75 0 0 0-1.06 0L.22 8.47A.75.75 0 0 0 0 9z',
fr: 'evenodd',
'0 0 0 .772-1.228L5.53 1.22a.75.75 0 0 0-1.06 0L.22 5.47A.75.75 0 0 0 0 6zm0 ' +
'3a.75.75 0 0 0 1.28.53l2.97-2.97V14a.75.75 0 1 0 1.5 0V6.56l2.97 2.97a.75.75 ' +
'0 0 0 1.06-1.06L5.53 4.22a.75.75 0 0 0-1.06 0L.22 8.47A.75.75 0 0 0 0 9z',
],
}
/**
@ -482,7 +487,7 @@ export class PushPullButton extends React.Component<
title="Publish repository"
description="Publish this repository to GitHub"
className="push-pull-button"
icon={OcticonSymbol.upload}
icon={octicons.upload}
style={ToolbarButtonStyle.Subtitle}
onClick={onClick}
/>
@ -495,7 +500,7 @@ export class PushPullButton extends React.Component<
{...this.defaultButtonProps()}
title="Publish branch"
description="Cannot publish unborn HEAD"
icon={OcticonSymbol.upload}
icon={octicons.upload}
disabled={true}
/>
)
@ -511,7 +516,7 @@ export class PushPullButton extends React.Component<
{...this.defaultButtonProps()}
title="Publish branch"
description={description}
icon={OcticonSymbol.upload}
icon={octicons.upload}
disabled={true}
/>
)
@ -539,7 +544,7 @@ export class PushPullButton extends React.Component<
{...this.defaultDropdownProps()}
title="Publish branch"
description={description}
icon={OcticonSymbol.upload}
icon={octicons.upload}
onClick={onClick}
className={className}
dropdownContentRenderer={this.getDropdownContentRenderer([
@ -590,7 +595,7 @@ export class PushPullButton extends React.Component<
{...this.defaultDropdownProps()}
title={title}
description={renderLastFetched(lastFetched)}
icon={OcticonSymbol.arrowDown}
icon={octicons.arrowDown}
onClick={onClick}
dropdownContentRenderer={this.getDropdownContentRenderer(
dropdownItemTypes
@ -615,7 +620,7 @@ export class PushPullButton extends React.Component<
{...this.defaultDropdownProps()}
title={`Push ${remoteName}`}
description={renderLastFetched(lastFetched)}
icon={OcticonSymbol.arrowUp}
icon={octicons.arrowUp}
onClick={onClick}
dropdownContentRenderer={this.getDropdownContentRenderer([
DropdownItemType.Fetch,

View file

@ -5,7 +5,7 @@ import { Dispatcher } from '../dispatcher'
import { Repository } from '../../models/repository'
import { PopupType } from '../../models/popup'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { SuggestedAction } from '../suggested-actions'
import { SuggestedActionGroup } from '../suggested-actions'
@ -14,9 +14,9 @@ const ClappingHandsImage = encodePathAsUrl(
'static/admin-mentoring.svg'
)
const TelescopeOcticon = <Octicon symbol={OcticonSymbol.telescope} />
const PlusOcticon = <Octicon symbol={OcticonSymbol.plus} />
const FileDirectoryOcticon = <Octicon symbol={OcticonSymbol.fileDirectory} />
const TelescopeOcticon = <Octicon symbol={octicons.telescope} />
const PlusOcticon = <Octicon symbol={octicons.plus} />
const FileDirectoryOcticon = <Octicon symbol={octicons.fileDirectory} />
interface ITutorialDoneProps {
readonly dispatcher: Dispatcher

View file

@ -5,7 +5,7 @@ import { Button } from '../lib/button'
import { Repository } from '../../models/repository'
import { Dispatcher } from '../dispatcher'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import {
ValidTutorialStep,
TutorialStep,
@ -256,7 +256,7 @@ export class TutorialPanel extends React.Component<
<div className="action">
<Button onClick={this.openPullRequest}>
{__DARWIN__ ? 'Open Pull Request' : 'Open pull request'}
<Octicon symbol={OcticonSymbol.linkExternal} />
<Octicon symbol={octicons.linkExternal} />
</Button>
<KeyboardShortcut darwinKeys={['⌘', 'R']} keys={['Ctrl', 'R']} />
</div>

View file

@ -6,7 +6,7 @@ import {
orderedTutorialSteps,
} from '../../models/tutorial-step'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
interface ITutorialStepInstructionsProps {
/** Text displayed to summarize this step */
@ -58,7 +58,7 @@ export class TutorialStepInstructions extends React.Component<ITutorialStepInstr
{shouldShowSkipLink ? (
this.props.skipLinkButton
) : (
<Octicon symbol={OcticonSymbol.chevronDown} />
<Octicon symbol={octicons.chevronDown} />
)}
</span>
</summary>
@ -69,7 +69,7 @@ export class TutorialStepInstructions extends React.Component<ITutorialStepInstr
if (this.props.isComplete(this.props.sectionId)) {
return (
<div className="green-circle">
<Octicon symbol={OcticonSymbol.check} />
<Octicon symbol={octicons.check} />
</div>
)
}

View file

@ -3,7 +3,7 @@ import { WelcomeStep } from './welcome'
import { LinkButton } from '../lib/link-button'
import { Dispatcher } from '../dispatcher'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { Button } from '../lib/button'
import { Loading } from '../lib/loading'
import { BrowserRedirectMessage } from '../lib/authentication-form'
@ -54,7 +54,7 @@ export class Start extends React.Component<IStartProps, {}> {
>
{this.props.loadingBrowserAuth && <Loading />}
Sign in to GitHub.com
<Octicon symbol={OcticonSymbol.linkExternal} />
<Octicon symbol={octicons.linkExternal} />
</Button>
{this.props.loadingBrowserAuth ? (
<Button onClick={this.cancelBrowserAuth}>Cancel</Button>

View file

@ -3,7 +3,7 @@ import memoizeOne from 'memoize-one'
import { WindowState } from '../../lib/window-state'
import { WindowControls } from './window-controls'
import { Octicon } from '../octicons/octicon'
import * as OcticonSymbol from '../octicons/octicons.generated'
import * as octicons from '../octicons/octicons.generated'
import { isMacOSBigSurOrLater } from '../../lib/get-os'
import {
getAppleActionOnDoubleClick,
@ -103,7 +103,7 @@ export class TitleBar extends React.Component<ITitleBarProps> {
this.props.titleBarStyle === 'light' ? 'light-title-bar' : ''
const appIcon = this.props.showAppIcon ? (
<Octicon className="app-icon" symbol={OcticonSymbol.markGithub} />
<Octicon className="app-icon" symbol={octicons.markGithub} />
) : null
const onTitlebarDoubleClick = __DARWIN__

View file

@ -120,3 +120,8 @@
z-index: 1;
}
}
.button-component.copy-button .octicon {
height: 12px;
width: 12px;
}

View file

@ -12,11 +12,7 @@
}
.green-circle {
background-color: var(--color-new);
color: var(--background-color);
border-radius: 50%;
height: 16px;
width: 16px;
color: var(--color-new);
display: flex;
justify-content: center;
align-items: center;

View file

@ -1,5 +1,5 @@
import { iconForRepository } from '../../src/ui/octicons'
import * as OcticonSymbol from '../../src/ui/octicons/octicons.generated'
import * as octicons from '../../src/ui/octicons/octicons.generated'
import { CloningRepository } from '../../src/models/cloning-repository'
import { Repository } from '../../src/models/repository'
import { gitHubRepoFixture } from '../helpers/github-repo-builder'
@ -11,13 +11,13 @@ describe('octicon/iconForRepository', () => {
'https://github.com/desktop/desktop'
)
const icon = iconForRepository(repository)
expect(icon).toEqual(OcticonSymbol.desktopDownload)
expect(icon).toEqual(octicons.desktopDownload)
})
it('shows computer icon for non-GitHub repository', () => {
const repository = new Repository('C:/some/path/to/repo', 1, null, false)
const icon = iconForRepository(repository)
expect(icon).toEqual(OcticonSymbol.deviceDesktop)
expect(icon).toEqual(octicons.deviceDesktop)
})
it('shows repo icon for public GitHub repository', () => {
@ -33,7 +33,7 @@ describe('octicon/iconForRepository', () => {
false
)
const icon = iconForRepository(repository)
expect(icon).toEqual(OcticonSymbol.repo)
expect(icon).toEqual(octicons.repo)
})
it('shows lock icon for private GitHub repository', () => {
@ -49,7 +49,7 @@ describe('octicon/iconForRepository', () => {
false
)
const icon = iconForRepository(repository)
expect(icon).toEqual(OcticonSymbol.lock)
expect(icon).toEqual(octicons.lock)
})
it('shows fork icon for forked GitHub repository', () => {
@ -66,6 +66,6 @@ describe('octicon/iconForRepository', () => {
false
)
const icon = iconForRepository(repository)
expect(icon).toEqual(OcticonSymbol.repoForked)
expect(icon).toEqual(octicons.repoForked)
})
})

View file

@ -54,7 +54,7 @@
"@azure/storage-blob": "^12.13.0",
"@babel/core": "^7.23.5",
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
"@primer/octicons": "^10.0.0",
"@primer/octicons": "^19.0.0",
"@types/lodash": "^4.14.178",
"@types/marked": "^4.0.1",
"@types/plist": "^3.0.2",

View file

@ -9,94 +9,79 @@ import * as fs from 'fs'
import * as Path from 'path'
import * as cp from 'child_process'
import { check } from 'reserved-words'
import xml2js from 'xml2js'
import toCamelCase from 'to-camel-case'
interface IXML2JSNode {
path: {
$: {
d: string
'fill-rule'?: string
}
}
}
interface IOcticonData {
readonly jsFriendlyName: string
readonly pathData: string
readonly width: string
readonly height: string
readonly fillRule?: string
}
const viewBoxRe = /0 0 (\d+) (\d+)/
function readXml(xml: string): Promise<IXML2JSNode> {
return new Promise((resolve, reject) => {
xml2js.parseString(xml, function (err, result: IXML2JSNode) {
if (err) {
reject(err)
} else {
resolve(result)
// Basic type for the @primer/octicons package.
type OcticonsLib = Record<
string,
{
readonly symbol: string
readonly heights: Record<
string,
{
readonly ast: {
readonly children: ReadonlyArray<{
readonly attributes: {
readonly d: string
}
}>
}
readonly options: {
readonly height: string
readonly width: string
}
}
})
})
>
}
>
interface IOcticonVariant {
p: string[]
h: number
w: number
}
interface IOcticon {
/** JS friendly name of the icon. */
readonly name: string
/** Size variants of the icon. */
readonly variants: Record<PropertyKey, IOcticonVariant>
}
function getJsFriendlyName(name: string) {
const sanitizedName = toCamelCase(name)
return check(sanitizedName, 'es6', true) ? sanitizedName + '_' : sanitizedName
}
async function generateIconData(): Promise<ReadonlyArray<IOcticonData>> {
const octicons = require('@primer/octicons')
async function generateIconData(): Promise<ReadonlyArray<IOcticon>> {
const octicons: OcticonsLib = require('@primer/octicons')
const results = new Array<IOcticonData>()
return Object.keys(octicons)
.sort()
.map(name => {
const octicon = octicons[name]
for (const name of Object.keys(octicons).sort()) {
const octicon = octicons[name]
if (Object.keys(octicon.heights).length === 0) {
throw new Error(`Unexpected empty sizes array for ${octicon.symbol}`)
}
if (octicon.heights.length === 0) {
throw new Error(`Unexpected empty sizes array for ${octicon.symbol}`)
}
const variants: Record<PropertyKey, IOcticonVariant> = {}
// Try to get the 16px version of the SVG data if it exists,
// if it doesn't just fallback to the version that is defined.
const octiconData =
octicon.heights['16'] ?? octicon.heights[Object.keys(octicon.heights)[0]]
Object.entries(octicon.heights).forEach(([height, data]) => {
variants[height] = {
p: data.ast.children.map(c => c.attributes.d),
h: parseInt(data.options.height, 10),
w: parseInt(data.options.width, 10),
}
})
const viewBox = octiconData.options.viewBox
const viewBoxMatch = viewBoxRe.exec(viewBox)
if (!viewBoxMatch) {
throw new Error(
`Unexpected viewBox format for ${octicon.symbol} - '${viewBox}'`
)
}
const [, width, height] = viewBoxMatch
const result = await readXml(octiconData.path)
const pathData = result.path.$.d
const jsFriendlyName = getJsFriendlyName(octicon.symbol)
const fillRule = result.path.$['fill-rule']
results.push({
jsFriendlyName,
width,
height,
pathData,
fillRule,
return { name: getJsFriendlyName(name), variants }
})
}
return results
}
generateIconData().then(result => {
console.log(`Writing ${result.length} octicons...`)
generateIconData().then(results => {
console.log(`Writing ${results.length} octicons...`)
const out = fs.createWriteStream(
Path.resolve(__dirname, '../app/src/ui/octicons/octicons.generated.ts'),
@ -105,23 +90,31 @@ generateIconData().then(result => {
}
)
out.write('/*\n')
out.write(
' * This file is automatically generated by the generate-octicons tool.\n'
)
out.write(' * Manually changing this file will only lead to sadness.\n')
out.write(' */\n\n')
out.write(`/*
* This file is automatically generated by the generate-octicons tool.
* Manually changing this file will only lead to sadness.
*/
out.write(
"export type OcticonSymbolType = {readonly w: number, readonly h: number, readonly d: string, readonly fr?: React.SVGAttributes<SVGElement>['fillRule']}\n\n"
)
export type OcticonSymbolVariant = {
/** SVG path element data */
readonly p: string[]
result.forEach(function (symbol) {
const { jsFriendlyName, pathData, width, height, fillRule } = symbol
/** The width of the symbol */
readonly w: number
/** The height of the symbol */
readonly h: number
}
export type OcticonSymbolVariants = Record<PropertyKey, OcticonSymbolVariant>
export type OcticonSymbol = OcticonSymbolVariant | OcticonSymbolVariants\n\n`)
results.forEach(icon => {
out.write(
`export const ${jsFriendlyName}: OcticonSymbolType = {w: ${width}, h: ${height}, d: '${pathData}', fr: ${
fillRule ? `'${fillRule}'` : 'undefined'
}}\n\n`
`export const ${icon.name}: OcticonSymbolVariants = ${JSON.stringify(
icon.variants
)}\n`
)
})

View file

@ -1012,10 +1012,10 @@
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1"
integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==
"@primer/octicons@^10.0.0":
version "10.0.0"
resolved "https://registry.yarnpkg.com/@primer/octicons/-/octicons-10.0.0.tgz#81e94ed32545dfd3472c8625a5b345f3ea4c153d"
integrity sha512-iuQubq62zXZjPmaqrsfsCZUqIJgZhmA6W0tKzIKGRbkoLnff4TFFCL87hfIRATZ5qZPM4m8ioT8/bXI7WVa9WQ==
"@primer/octicons@^19.0.0":
version "19.8.0"
resolved "https://registry.yarnpkg.com/@primer/octicons/-/octicons-19.8.0.tgz#67cad2f55cd1c6e5ccae2670b9c1f595321995d1"
integrity sha512-Imze/fyW41Io5fN+27T5EAeXJrgBjMbz6nzU+wYbRylXvIAjLPUvaJPVoStiFlgSU+TjTUJqg5A9rgMDzTyMCg==
dependencies:
object-assign "^4.1.1"
@ -7121,7 +7121,7 @@ nwsapi@^2.2.2:
object-assign@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
object-copy@^0.1.0:
version "0.1.0"