[improvement] remove sponsorship color (#691)

* remove sponsorship variations

* Update menu
This commit is contained in:
Steve Ruiz 2022-05-18 13:09:11 +01:00 committed by GitHub
parent e2a6badaef
commit fbb29c87b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 43 deletions

View file

@ -42,7 +42,7 @@ export default function Develop() {
onSignIn={handleSignIn} onSignIn={handleSignIn}
onSignOut={handleSignOut} onSignOut={handleSignOut}
onPersist={handlePersist} onPersist={handlePersist}
showSponsorLink={false} showSponsorLink={true}
/> />
</div> </div>
) )

View file

@ -107,9 +107,9 @@ export function Tldraw({
showStyles = true, showStyles = true,
showUI = true, showUI = true,
readOnly = false, readOnly = false,
showSponsorLink = false,
disableAssets = false, disableAssets = false,
darkMode = false, darkMode = false,
showSponsorLink,
onMount, onMount,
onChange, onChange,
onChangePresence, onChangePresence,
@ -304,6 +304,7 @@ export function Tldraw({
interface InnerTldrawProps { interface InnerTldrawProps {
id?: string id?: string
autofocus: boolean autofocus: boolean
readOnly: boolean
showPages: boolean showPages: boolean
showMenu: boolean showMenu: boolean
showMultiplayerMenu: boolean showMultiplayerMenu: boolean
@ -311,8 +312,7 @@ interface InnerTldrawProps {
showStyles: boolean showStyles: boolean
showUI: boolean showUI: boolean
showTools: boolean showTools: boolean
showSponsorLink: boolean showSponsorLink?: boolean
readOnly: boolean
} }
const InnerTldraw = React.memo(function InnerTldraw({ const InnerTldraw = React.memo(function InnerTldraw({
@ -508,7 +508,7 @@ const InnerTldraw = React.memo(function InnerTldraw({
showMultiplayerMenu={showMultiplayerMenu} showMultiplayerMenu={showMultiplayerMenu}
showStyles={showStyles} showStyles={showStyles}
showZoom={showZoom} showZoom={showZoom}
showSponsorLink={showSponsorLink} sponsor={showSponsorLink}
/> />
<StyledSpacer /> <StyledSpacer />
{showTools && !readOnly && <ToolsPanel />} {showTools && !readOnly && <ToolsPanel />}

View file

@ -29,7 +29,6 @@ export const RowButton = React.forwardRef<HTMLButtonElement, RowButtonProps>(
hasIndicator = false, hasIndicator = false,
hasArrow = false, hasArrow = false,
disabled = false, disabled = false,
isSponsor = false,
variant, variant,
kbd, kbd,
children, children,
@ -43,7 +42,6 @@ export const RowButton = React.forwardRef<HTMLButtonElement, RowButtonProps>(
bp={breakpoints} bp={breakpoints}
isWarning={isWarning} isWarning={isWarning}
isActive={isActive} isActive={isActive}
isSponsor={isSponsor}
disabled={disabled} disabled={disabled}
onClick={onClick} onClick={onClick}
variant={variant} variant={variant}
@ -89,6 +87,10 @@ const StyledRowButtonInner = styled('div', {
strokeWidth: 1, strokeWidth: 1,
zIndex: 1, zIndex: 1,
}, },
[`& > ${SmallIcon}`]: {
paddingLeft: '$3',
},
}) })
export const StyledRowButton = styled('button', { export const StyledRowButton = styled('button', {

View file

@ -10,7 +10,6 @@ export interface ToolButtonProps {
onDoubleClick?: () => void onDoubleClick?: () => void
disabled?: boolean disabled?: boolean
isActive?: boolean isActive?: boolean
isSponsor?: boolean
isToolLocked?: boolean isToolLocked?: boolean
variant?: 'icon' | 'text' | 'circle' | 'primary' variant?: 'icon' | 'text' | 'circle' | 'primary'
children: React.ReactNode children: React.ReactNode
@ -29,7 +28,6 @@ export const ToolButton = React.forwardRef<HTMLButtonElement, ToolButtonProps>(
isToolLocked = false, isToolLocked = false,
disabled = false, disabled = false,
isActive = false, isActive = false,
isSponsor = false,
onKeyDown, onKeyDown,
id, id,
...rest ...rest
@ -40,7 +38,6 @@ export const ToolButton = React.forwardRef<HTMLButtonElement, ToolButtonProps>(
<StyledToolButton <StyledToolButton
ref={ref} ref={ref}
isActive={isActive} isActive={isActive}
isSponsor={isSponsor}
variant={variant} variant={variant}
onClick={onClick} onClick={onClick}
disabled={disabled} disabled={disabled}
@ -211,30 +208,6 @@ export const StyledToolButton = styled('button', {
}, },
}, },
}, },
{
isActive: true,
isSponsor: false,
css: {
[`${StyledToolButtonInner}`]: {
backgroundColor: '$selected',
color: '$selectedContrast',
},
},
},
{
isActive: false,
isSponsor: false,
bp: 'small',
css: {
[`&:hover:not(:disabled) ${StyledToolButtonInner}`]: {
backgroundColor: '$hover',
border: '1px solid $panel',
},
[`&:focus:not(:disabled) ${StyledToolButtonInner}`]: {
backgroundColor: '$hover',
},
},
},
], ],
}) })

View file

@ -1,5 +1,11 @@
import * as React from 'react' import * as React from 'react'
import { ExitIcon, GitHubLogoIcon, HamburgerMenuIcon, TwitterLogoIcon } from '@radix-ui/react-icons' import {
ExitIcon,
GitHubLogoIcon,
HamburgerMenuIcon,
HeartFilledIcon,
TwitterLogoIcon,
} from '@radix-ui/react-icons'
import * as DropdownMenu from '@radix-ui/react-dropdown-menu' import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import { useTldrawApp } from '~hooks' import { useTldrawApp } from '~hooks'
import { PreferencesMenu } from '../PreferencesMenu' import { PreferencesMenu } from '../PreferencesMenu'
@ -19,7 +25,7 @@ import { TDExportType, TDSnapshot } from '~types'
import { Divider } from '~components/Primitives/Divider' import { Divider } from '~components/Primitives/Divider'
interface MenuProps { interface MenuProps {
showSponsorLink: boolean sponsor: boolean | undefined
readOnly: boolean readOnly: boolean
} }
@ -31,7 +37,7 @@ const disableAssetsSelector = (s: TDSnapshot) => {
return s.appState.disableAssets return s.appState.disableAssets
} }
export const Menu = React.memo(function Menu({ showSponsorLink, readOnly }: MenuProps) { export const Menu = React.memo(function Menu({ sponsor, readOnly }: MenuProps) {
const app = useTldrawApp() const app = useTldrawApp()
const numberOfSelectedIds = app.useStore(numberOfSelectedIdsSelector) const numberOfSelectedIds = app.useStore(numberOfSelectedIdsSelector)
@ -123,13 +129,13 @@ export const Menu = React.memo(function Menu({ showSponsorLink, readOnly }: Menu
app.callbacks.onSaveProjectAs || app.callbacks.onSaveProjectAs ||
app.callbacks.onExport app.callbacks.onExport
const showSignInOutMenu = app.callbacks.onSignIn || app.callbacks.onSignOut || showSponsorLink const showSignInOutMenu = app.callbacks.onSignIn || app.callbacks.onSignOut
const hasSelection = numberOfSelectedIds > 0 const hasSelection = numberOfSelectedIds > 0
return ( return (
<DropdownMenu.Root dir="ltr"> <DropdownMenu.Root dir="ltr">
<DMTriggerIcon isSponsor={showSponsorLink} id="TD-MenuIcon"> <DMTriggerIcon id="TD-MenuIcon">
<HamburgerMenuIcon /> <HamburgerMenuIcon />
</DMTriggerIcon> </DMTriggerIcon>
<DMContent variant="menu" id="TD-Menu"> <DMContent variant="menu" id="TD-Menu">
@ -332,7 +338,7 @@ export const Menu = React.memo(function Menu({ showSponsorLink, readOnly }: Menu
</SmallIcon> </SmallIcon>
</DMItem> </DMItem>
</a> </a>
{showSponsorLink && ( {sponsor === false && (
<a href="https://github.com/sponsors/steveruizok" target="_blank" rel="nofollow"> <a href="https://github.com/sponsors/steveruizok" target="_blank" rel="nofollow">
<DMItem isSponsor id="TD-MenuItem-Become_a_Sponsor"> <DMItem isSponsor id="TD-MenuItem-Become_a_Sponsor">
Become a Sponsor{' '} Become a Sponsor{' '}
@ -342,6 +348,16 @@ export const Menu = React.memo(function Menu({ showSponsorLink, readOnly }: Menu
</DMItem> </DMItem>
</a> </a>
)} )}
{sponsor === true && (
<a href="https://github.com/sponsors/steveruizok" target="_blank" rel="nofollow">
<DMItem id="TD-MenuItem-is_a_Sponsor">
Sponsored!
<SmallIcon>
<HeartFilledIcon />
</SmallIcon>
</DMItem>
</a>
)}
{showSignInOutMenu && ( {showSignInOutMenu && (
<> <>
<DMDivider dir="ltr" />{' '} <DMDivider dir="ltr" />{' '}

View file

@ -18,7 +18,7 @@ interface TopPanelProps {
showStyles: boolean showStyles: boolean
showZoom: boolean showZoom: boolean
showMultiplayerMenu: boolean showMultiplayerMenu: boolean
showSponsorLink: boolean sponsor?: boolean
} }
export function TopPanel({ export function TopPanel({
@ -27,7 +27,7 @@ export function TopPanel({
showMenu, showMenu,
showStyles, showStyles,
showZoom, showZoom,
showSponsorLink, sponsor,
showMultiplayerMenu, showMultiplayerMenu,
}: TopPanelProps) { }: TopPanelProps) {
const app = useTldrawApp() const app = useTldrawApp()
@ -36,7 +36,7 @@ export function TopPanel({
<StyledTopPanel> <StyledTopPanel>
{(showMenu || showPages) && ( {(showMenu || showPages) && (
<Panel side="left" id="TD-MenuPanel"> <Panel side="left" id="TD-MenuPanel">
{showMenu && <Menu showSponsorLink={showSponsorLink} readOnly={readOnly} />} {showMenu && <Menu sponsor={sponsor} readOnly={readOnly} />}
{showMultiplayerMenu && <MultiplayerMenu />} {showMultiplayerMenu && <MultiplayerMenu />}
{showPages && <PageMenu />} {showPages && <PageMenu />}
</Panel> </Panel>