Skip to content

Commit

Permalink
Cody page fixes (#6813)
Browse files Browse the repository at this point in the history
* Fix animation line highlight

* Use h1 and sans font

* Tweak h3 color

* Clean up CTA button

* Reduce gap in header CTA

* Fix line numbers

* Fix code fonts

* Tweak CTA icon size
  • Loading branch information
toolmantim committed Mar 15, 2024
1 parent 07fe680 commit df850c2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/Banner.tsx
Expand Up @@ -14,7 +14,7 @@ export const Banner: FunctionComponent<{}> = () => (
className="btn bg-transparent !px-0 !py-0 leading-[22px] text-violet-300"
>
Read the blog
<ChevronRightIcon className="!mb-0 ml-[18px] inline" />
<ChevronRightIcon className="!mb-0 ml-[6px] inline" />
</Link>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/CodyAnimation/CodeHighlighter.tsx
Expand Up @@ -29,17 +29,17 @@ export const CodeHighlighter: FunctionComponent<CodeHighlighterProps> = ({

return (
<div
className={classNames('cody-animation relative m-0 p-0', {
className={classNames('cody-animation relative m-0 p-0 inline-flex', {
'apply-gray': !highlighted,
'inline-block': inline,
'inline-flex': inline,
})}
>
<pre>
<code ref={codeRef} className="language-javascript">
{text || children}
</code>
{showCursor && (
<div className="absolute inline-block pl-0.5">
<div className="absolute inline-flex pl-0.5">
<BlinkCursor />
</div>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/CodyAnimation/CodyAnimation.tsx
Expand Up @@ -83,7 +83,7 @@ export const CodyAnimation: FunctionComponent<{className?: string}> = ({classNam
}, [isCodyAnimationRefInView, applySuggestion])

const lineNumbers = countTotalLines(codes) + 2
const activeLine = showSuggestion ? lineNumbers : typingCodeLines || 1
const activeLine = (showSuggestion || applySuggestion) ? lineNumbers : startAnimation ? (typingCodeLines + 1) : 1

return (
<>
Expand Down Expand Up @@ -111,7 +111,7 @@ export const CodyAnimation: FunctionComponent<{className?: string}> = ({classNam
setCodeLines={setTypingCodeLines}
/>
) : (
<div className="m-0 p-0">
<div className="m-0 p-0 inline-flex">
<BlinkCursor />
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/CodyAnimation/Line.tsx
Expand Up @@ -9,7 +9,7 @@ interface Props {
}

export const Line: FunctionComponent<Props> = ({ children, className, active }) => (
<div className={classNames('items-center whitespace-nowrap', className, { 'bg-[#343A4D]': active })}>
<div className={classNames('items-center whitespace-nowrap font-systemMono', className, { 'bg-[#343A4D]': active })}>
{children}
</div>
)
2 changes: 1 addition & 1 deletion src/components/CodyAnimation/TypingAnimation.tsx
Expand Up @@ -41,7 +41,7 @@ export const TypingAnimation: FunctionComponent<TypingAnimationProps> = ({
useEffect(() => {
const observer = new ResizeObserver(entries => {
for (const entry of entries) {
setCodeLines?.(Math.floor(entry.contentRect.height / heightTextSize) || 1)
setCodeLines?.(Math.floor(entry.contentRect.height / heightTextSize) || 0)
}
})

Expand Down
12 changes: 6 additions & 6 deletions src/pages/cody.tsx
Expand Up @@ -83,24 +83,24 @@ const CodyPage: FunctionComponent = () => {
>
<ContentSection parentClassName="!py-0 !px-0" className="-mt-8 pt-0 text-center md:mt-0 md:pt-[22px]">
<div className="mx-auto w-full px-6 md:w-[849px] lg:w-[895px]">
<div className="mx-auto w-full pt-6 text-[48px] font-semibold leading-[58px] text-white md:text-[72px] md:leading-[86px]">
Code more, type less
</div>
<h1 className="mx-auto w-full pt-6 text-[48px] font-semibold leading-[48px] text-white md:text-[72px] md:leading-[86px]">
Code more, type&nbsp;less
</h1>
<Heading
size="h3"
className="mx-auto mb-8 mt-6 max-w-[663px] leading-[30px] !tracking-[-0.25px] text-gray-200"
className="mx-auto mb-8 mt-6 max-w-[700px] leading-[30px] !tracking-[-0.25px] text-[#FFFFFFbb]"
>
Cody is a coding AI assistant that uses AI and a deep understanding of your codebase to help you
write and understand code faster.
</Heading>
<button
type="button"
className="btn btn-inverted-primary min-w-[204px] px-6 py-3 text-violet-500 lg:px-4"
className="btn btn-inverted-primary px-5 py-3 text-violet-500"
title="Get Cody for free"
onClick={handleOpenModal}
>
<div className="flex items-center justify-center">
<img src="/cody/cody-logo.svg" className="mr-2 h-[24px] w-[24px]" alt="Cody Logo" />
<img src="/cody/cody-logo.svg" className="mr-2 h-[15px] w-[15px]" alt="Cody Logo" />
Get Cody for free
</div>
</button>
Expand Down
11 changes: 8 additions & 3 deletions src/styles/cody-animation.css
Expand Up @@ -2,8 +2,6 @@
.cody-animation pre[class*='language-'] {
background: transparent;
color: #c7ffff;
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
font-family: 'Fira Code', 'Fira Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
direction: ltr;
text-align: left;
white-space: pre;
Expand All @@ -15,6 +13,9 @@
tab-size: 2;
-webkit-hyphens: none;
hyphens: none;
/* Same stack as font-systemMono */
font-family: ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-weight: normal;
}

.cody-animation pre[class*='language-'] {
Expand All @@ -36,6 +37,10 @@
color: #ce9cff;
}

.cody-animation .token.comment {
font-style: normal;
}

.cody-animation .token.doctype,
.cody-animation .token.punctuation,
.cody-animation .token.entity {
Expand Down Expand Up @@ -151,7 +156,7 @@
.cody-multiple-lines::before {
content: '';
position: absolute;
bottom: 4.5px;
bottom: 0;
left: 0;
width: 100%;
height: 20px;
Expand Down

0 comments on commit df850c2

Please sign in to comment.