Skip to content

Commit

Permalink
Merge pull request #116 from chromaui/sticky-signup
Browse files Browse the repository at this point in the history
add sticky styles for signup button
  • Loading branch information
winkerVSbecks authored Dec 12, 2024
2 parents 18980ed + 5927d98 commit d04baec
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
32 changes: 21 additions & 11 deletions src/Header/Header.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { SubNav } from '../SubNav';
const meta: Meta<typeof Header> = {
title: 'Components/Header',
component: Header,
parameters: {
layout: 'fullscreen',
},
};

export default meta;
Expand All @@ -22,7 +25,6 @@ export const DesktopLight: Story = {
links: defaultLinks,
},
parameters: {
layout: 'fullscreen',
chromatic: { viewports: [940, 1024, 1280, 1536] },
viewport: {
defaultViewport: 'lg',
Expand All @@ -41,6 +43,24 @@ export const DesktopDark: Story = {
},
};

export const DesktopLightSticky: Story = {
args: {
...DesktopLight.args,
isSticky: true,
},
};

export const DesktopDarkSticky: Story = {
args: {
...DesktopLight.args,
theme: 'dark',
isSticky: true,
},
parameters: {
backgrounds: { default: 'dark' },
},
};

export const DesktopLoggedOut: Story = {
args: {
...DesktopLight.args,
Expand Down Expand Up @@ -128,7 +148,6 @@ export const DesktopLightOpen: Story = {
...DesktopLight.args,
},
parameters: {
layout: 'fullscreen',
chromatic: { pauseAnimationAtEnd: true, delay: 600 },
viewport: {
defaultViewport: 'lg',
Expand All @@ -151,7 +170,6 @@ export const DesktopDarkOpen: Story = {
theme: 'dark',
},
parameters: {
layout: 'fullscreen',
backgrounds: { default: 'dark' },
chromatic: { pauseAnimationAtEnd: true, delay: 600 },
viewport: {
Expand All @@ -174,7 +192,6 @@ export const TabletLight: Story = {
...DesktopLight.args,
},
parameters: {
layout: 'fullscreen',
chromatic: { viewports: [320, 640, 768, 939] },
viewport: {
defaultViewport: 'md',
Expand All @@ -188,7 +205,6 @@ export const TabletDark: Story = {
theme: 'dark',
},
parameters: {
layout: 'fullscreen',
chromatic: { viewports: [320, 640, 768, 939] },
viewport: {
defaultViewport: 'md',
Expand All @@ -202,7 +218,6 @@ export const TabletOpen: Story = {
...DesktopLight.args,
},
parameters: {
layout: 'fullscreen',
chromatic: { viewports: [320, 640, 768, 939] },
viewport: {
defaultViewport: 'md',
Expand Down Expand Up @@ -239,7 +254,6 @@ export const MobileOpen: Story = {
...DesktopLight.args,
},
parameters: {
layout: 'fullscreen',
chromatic: { viewports: [320, 640, 768, 939] },
viewport: {
defaultViewport: 'xsm',
Expand All @@ -260,17 +274,13 @@ export const DesktopFullWidth: Story = {
...DesktopLight.args,
fullWidth: true,
},
parameters: {
layout: 'fullscreen',
},
};

export const MobileFullWidth: Story = {
args: {
...DesktopLight.args,
},
parameters: {
layout: 'fullscreen',
viewport: {
defaultViewport: 'xsm',
},
Expand Down
5 changes: 3 additions & 2 deletions src/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const Header = ({
fullWidth = false,
loggedIn,
maintenanceMode,
isSticky,
TrackSignUp = DefaultTrackSignUp,
}: HeaderProps) => {
const HeaderContainer = fullWidth ? FullWidthContainer : Container;
Expand Down Expand Up @@ -151,8 +152,8 @@ export const Header = ({
<HeaderCTAButton
as="span"
size="sm"
variant="outline"
color={theme === 'dark' ? 'white' : 'blue'}
variant={isSticky ? 'solid' : 'outline'}
color={theme === 'light' || isSticky ? 'blue' : 'white'}
href={links.signup.href}
>
{links.signup.title}
Expand Down
1 change: 1 addition & 0 deletions src/Header/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export interface HeaderProps {
fullWidth?: boolean;
loggedIn?: boolean;
maintenanceMode?: boolean;
isSticky?: boolean;
links: HeaderLinks;
TrackSignUp: ComponentType<{ children: ReactNode }>;
}
Expand Down

0 comments on commit d04baec

Please sign in to comment.