-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dw-virtual-data-warehouse-table-breakdowns
- Loading branch information
Showing
9 changed files
with
312 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
export const UNUSED_ICONS = [ | ||
'IconAdvanced', | ||
'IconAsterisk', | ||
'IconGridMasonry', | ||
'IconApps', | ||
'IconRibbon', | ||
'IconPulse', | ||
'IconPineapple', | ||
'IconPizza', | ||
'IconTarget', | ||
'IconThumbsUp', | ||
'IconThumbsUpFilled', | ||
'IconThumbsDown', | ||
'IconThumbsDownFilled', | ||
'IconShieldLock', | ||
] | ||
|
||
export const OBJECTS = { | ||
Misc: [ | ||
'IconPalette', | ||
'IconMegaphone', | ||
'IconRocket', | ||
'IconMap', | ||
'IconTie', | ||
'IconCoffee', | ||
'IconFlag', | ||
'IconCreditCard', | ||
'IconCrown', | ||
'IconBolt', | ||
'IconBook', | ||
'IconConfetti', | ||
'IconPresent', | ||
'IconMagicWand', | ||
'IconMagic', | ||
'IconHelmet', | ||
'IconSpotlight', | ||
'IconGraduationCap', | ||
'IconLightBulb', | ||
'IconBell', | ||
'IconBox', | ||
'IconBuilding', | ||
'IconEye', | ||
'IconFeatures', | ||
'IconHome', | ||
'IconHomeFilled', | ||
'IconGear', | ||
'IconGearFilled', | ||
'IconStack', | ||
], | ||
People: ['IconPeople', 'IconPeopleFilled', 'IconPerson', 'IconProfile', 'IconUser'], | ||
'Business & Finance': ['IconStore', 'IconCart', 'IconReceipt', 'IconPiggyBank'], | ||
Time: ['IconHourglass', 'IconCalendar', 'IconClock'], | ||
Nature: ['IconDay', 'IconNight', 'IconGlobe', 'IconCloud', 'IconBug'], | ||
Text: ['IconDocument', 'IconBrackets', 'IconTextWidth', 'IconQuote', 'IconLetter', 'IconNewspaper'], | ||
} | ||
|
||
export const TECHNOLOGY = { | ||
Messaging: ['IconSend', 'IconHeadset', 'IconMessage', 'IconNotification', 'IconChat', 'IconThoughtBubble'], | ||
Hardware: [ | ||
'IconLaptop', | ||
'IconPhone', | ||
'IconWebcam', | ||
'IconMicrophone', | ||
'IconKeyboard', | ||
'IconServer', | ||
'IconDatabase', | ||
'IconHardDrive', | ||
], | ||
Software: ['IconBrowser', 'IconCode', 'IconCodeInsert', 'IconTerminal', 'IconApp'], | ||
UI: [ | ||
'IconPassword', | ||
'IconToggle', | ||
'IconLoading', | ||
'IconSpinner', | ||
'IconBrightness', | ||
'IconCursor', | ||
'IconCursorBox', | ||
'IconCursorClick', | ||
'IconToolbar', | ||
'IconToolbarFilled', | ||
'IconCheckbox', | ||
'IconList', | ||
'IconColumns', | ||
], | ||
} | ||
|
||
export const ELEMENTS = { | ||
Actions: [ | ||
'IconCopy', | ||
'IconTrash', | ||
'IconUndo', | ||
'IconRedo', | ||
'IconRevert', | ||
'IconSearch', | ||
'IconUpload', | ||
'IconShare', | ||
'IconDownload', | ||
'IconLeave', | ||
'IconPin', | ||
'IconPinFilled', | ||
'IconPencil', | ||
'IconOpenSidebar', | ||
'IconFilter', | ||
'IconArchive', | ||
'IconSort', | ||
'IconExternal', | ||
], | ||
Symbols: [ | ||
'IconLock', | ||
'IconUnlock', | ||
'IconPrivacy', | ||
'IconShield', | ||
'IconWarning', | ||
'IconQuestion', | ||
'IconInfo', | ||
'IconCheckCircle', | ||
'IconCheck', | ||
'IconX', | ||
'IconEllipsis', | ||
], | ||
'Arrows & Shapes': [ | ||
'IconArrowLeft', | ||
'IconArrowRight', | ||
'IconArrowCircleLeft', | ||
'IconArrowCircleRight', | ||
'IconArrowRightDown', | ||
'IconArrowUpRight', | ||
'IconCollapse', | ||
'IconExpand', | ||
'IconCollapse45', | ||
'IconExpand45', | ||
'IconChevronDown', | ||
'IconTriangleDown', | ||
'IconTriangleDownFilled', | ||
'IconTriangleUp', | ||
'IconTriangleUpFilled', | ||
'IconStar', | ||
'IconStarFilled', | ||
'IconHeart', | ||
'IconHeartFilled', | ||
], | ||
Mathematics: [ | ||
'IconPlus', | ||
'IconPlusSmall', | ||
'IconPlusSquare', | ||
'IconMinus', | ||
'IconMinusSmall', | ||
'IconMinusSquare', | ||
'IconMultiply', | ||
'IconPercentage', | ||
'IconCalculator', | ||
], | ||
} | ||
|
||
export const TEAMS_AND_COMPANIES = { | ||
Analytics: [ | ||
'IconCorrelationAnalysis', | ||
'IconGraph', | ||
'IconLineGraph', | ||
'IconRetention', | ||
'IconFunnels', | ||
'IconGanttChart', | ||
'IconTrending', | ||
'IconTrends', | ||
'IconLifecycle', | ||
'IconPieChart', | ||
'IconUserPaths', | ||
'IconStickiness', | ||
'IconPageChart', | ||
'IconSampling', | ||
'IconLive', | ||
'IconBadge', | ||
], | ||
Replay: [ | ||
'IconPlay', | ||
'IconPlayFilled', | ||
'IconPlaylist', | ||
'IconPause', | ||
'IconPauseFilled', | ||
'IconRewind', | ||
'IconRecord', | ||
'IconRewindPlay', | ||
'IconVideoCamera', | ||
], | ||
'Feature Success': ['IconFlask', 'IconTestTube', 'IconMultivariateTesting', 'IconSplitTesting'], | ||
Pipeline: ['IconWebhooks', 'IconDecisionTree'], | ||
'Product OS': ['IconNotebook', 'IconHogQL', 'IconDashboard', 'IconSupport'], | ||
Logos: ['IconLogomark', 'IconGithub'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as packageIcons from '@posthog/icons' | ||
|
||
import { ELEMENTS, OBJECTS, TEAMS_AND_COMPANIES, TECHNOLOGY, UNUSED_ICONS } from './categories' | ||
|
||
describe('icons', () => { | ||
it('ensures all icons are categorised', async () => { | ||
const validPackageIcons = Object.keys(packageIcons).filter((i) => !['BaseIcon', 'default'].includes(i)) | ||
const categories = { ...OBJECTS, ...TECHNOLOGY, ...ELEMENTS, ...TEAMS_AND_COMPANIES } | ||
const categorisedIcons = Object.values(categories) | ||
.map((category) => Object.values(category)) | ||
.flat(2) | ||
|
||
const allIcons = [...categorisedIcons, ...UNUSED_ICONS] | ||
|
||
expect(validPackageIcons.filter((i) => !allIcons.includes(i))).toEqual([]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import * as packageIcons from '@posthog/icons' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { copyToClipboard } from 'lib/utils/copyToClipboard' | ||
|
||
import { LemonCollapse } from '../LemonCollapse' | ||
import { Tooltip } from '../Tooltip' | ||
import { ELEMENTS, OBJECTS, TEAMS_AND_COMPANIES, TECHNOLOGY } from './categories' | ||
|
||
const meta: Meta = { | ||
title: 'PostHog 3000/Icons', | ||
tags: ['test-skip'], | ||
parameters: { | ||
previewTabs: { | ||
'storybook/docs/panel': { | ||
hidden: true, | ||
}, | ||
}, | ||
}, | ||
} | ||
export default meta | ||
|
||
const posthogIcons = Object.entries(packageIcons) | ||
.filter(([key]) => key !== 'BaseIcon') | ||
.map(([key, Icon]) => ({ name: key, icon: Icon })) | ||
|
||
const IconTemplate = ({ icons }: { icons: { name: string; icon: any }[] }): JSX.Element => { | ||
const onClick = (name: string): void => { | ||
void copyToClipboard(name) | ||
} | ||
|
||
return ( | ||
<div className="grid grid-cols-6 gap-4"> | ||
{icons.map(({ name, icon: Icon }) => { | ||
return ( | ||
<div onClick={() => onClick(name)} key={name} className="flex justify-center"> | ||
<Tooltip title="Click to copy"> | ||
<div className="flex flex-col items-center space-y-2 max-w-24 py-2 px-4 cursor-pointer rounded hover:bg-secondary-3000"> | ||
<Icon className="w-10 h-10" /> | ||
<span className="text-xs">{name}</span> | ||
</div> | ||
</Tooltip> | ||
</div> | ||
) | ||
})} | ||
</div> | ||
) | ||
} | ||
|
||
export function Alphabetical(): JSX.Element { | ||
return <IconTemplate icons={posthogIcons} /> | ||
} | ||
|
||
const GroupBase = ({ group }: { group: Record<string, string[]> }): JSX.Element => { | ||
return ( | ||
<LemonCollapse | ||
multiple | ||
panels={Object.entries(group).map(([key, icons]) => { | ||
return { | ||
key, | ||
header: key, | ||
content: ( | ||
<IconTemplate | ||
icons={icons.map((icon) => { | ||
return { name: icon, icon: packageIcons[icon] } | ||
})} | ||
/> | ||
), | ||
} | ||
})} | ||
/> | ||
) | ||
} | ||
|
||
export const Elements: StoryObj = (): JSX.Element => { | ||
return <GroupBase group={ELEMENTS} /> | ||
} | ||
Elements.storyName = 'Category - Elements' | ||
|
||
export const TeamsAndCompanies: StoryObj = (): JSX.Element => { | ||
return <GroupBase group={TEAMS_AND_COMPANIES} /> | ||
} | ||
TeamsAndCompanies.storyName = 'Category - Teams & Companies' | ||
|
||
export const Technology: StoryObj = (): JSX.Element => { | ||
return <GroupBase group={TECHNOLOGY} /> | ||
} | ||
Technology.storyName = 'Category - Technology' | ||
|
||
export const Objects: StoryObj = (): JSX.Element => { | ||
return <GroupBase group={OBJECTS} /> | ||
} | ||
Objects.storyName = 'Category - Objects' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters