Skip to content

Commit

Permalink
feat(header): add action buttons to the mobile nav
Browse files Browse the repository at this point in the history
  • Loading branch information
bsahitya committed Jun 14, 2024
1 parent c15487d commit 19b8726
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@

.dropdownMenu {
margin-top: 5px;
padding: 0;
list-style: none;
background-color: transparent;
padding: 0 2.5rem;
padding: 0 1.5rem;
}

.dropdownMenuItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';

import Header from './index';
import Icon from '../Icon';
import Button from '../Button';

const meta = {
title: 'Components/Header',
Expand Down Expand Up @@ -86,7 +87,10 @@ const meta = {
),
type: 'search',
},
{ actionElement: <Icon className="fa fa-home" />, type: 'button' },
{
actionElement: <Button icon="fa fa-home" label="Start free demo" />,
type: 'button',
},
],
},
} satisfies Meta<typeof Header>;
Expand Down
11 changes: 11 additions & 0 deletions libs/react-components/src/lib/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,17 @@ const Header: React.FC<HeaderProps> = ({
</div>

<footer>
<ul
className={`${styles.headerNavActions} ${styles.headerNavElement} ${styles.headerNavMobileActions}`}
>
{headerActions &&
headerActions.map(
(action, index) =>
action.type === 'button' && (
<li key={index}>{action.actionElement}</li>
)
)}
</ul>
<div className={styles.headerNavMobileFooter}>
<ul>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ body {

.headerNavMobileFooter ul {
margin: 1em 0;
padding: 0 2rem;
padding: 0 1.5rem;
display: flex;
align-items: center;
}
Expand All @@ -232,6 +232,18 @@ body {
font-weight: 700;
}

.headerNavMobileDropdownMenu {
overflow: auto;
}

.headerNavMobileActions {
padding: 0 1.5rem;

li {
margin: 1.5rem 0;
}
}

.headerNavMobileSecondaryMenu {
padding-top: 1.5rem;
padding-left: 2px;
Expand Down

0 comments on commit 19b8726

Please sign in to comment.