Skip to content

Commit

Permalink
Remove the MeganavSignedIn story to avoid separating it from Meganav
Browse files Browse the repository at this point in the history
Added a new SignedInStory
- Default will be not login by assigning the sessionData empty http handler
- Added a new  Meganav SignedIn story with signed in data by adding a dummy http response account signed in

adjusting the space between the account name and search icon
  • Loading branch information
aralovelace committed Jul 18, 2024
1 parent 6428dad commit 711737c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 49 deletions.
39 changes: 36 additions & 3 deletions src/core/Meganav/Meganav.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect } from "react";
import { http, HttpResponse } from "msw";

import Meganav from "../Meganav";
import loadIcons from "../icons.js";
import logo from "../images/ably-logo.png";
Expand All @@ -26,7 +25,18 @@ export default {
msw: {
handlers: [
http.get("/api/me", () => {
return HttpResponse.json({});
return HttpResponse.json({
accountName: "Account Name",
signedIn: true,
account: {
links: {
dashboard: {
text: "Dashboard",
href: "/accounts/1",
},
},
},
});
}),
http.get("/api/blog", () => {
return HttpResponse.json([
Expand Down Expand Up @@ -66,7 +76,7 @@ const Page = () => {

const store = getRemoteDataStore();

fetchSessionData(store, "/api/me");
fetchSessionData(store, "");
fetchBlogPosts(store, "/api/blog");
}, []);

Expand All @@ -84,3 +94,26 @@ const Page = () => {
export const Default = {
render: () => <Page />,
};

const PageSignedIn = () => {
useEffect(() => {
loadIcons();
const store = getRemoteDataStore();
fetchSessionData(store, "/api/me");
fetchBlogPosts(store, "/api/blog");
}, []);

return (
<Meganav
paths={{
logo,
ablyStack,
awsLogo,
}}
/>
);
};

export const SignedIn = {
render: () => <PageSignedIn />,
};
45 changes: 0 additions & 45 deletions src/core/MeganavItemsSignedIn.stories.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/core/MeganavItemsSignedIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const MeganavItemsSignedIn = ({
return (
<ul className="hidden md:flex items-center">
<li className="ui-meganav-item relative">
<span className="ui-meganav-link h-64 hover:text-cool-black">
<span className="ui-meganav-link h-64 hover:text-cool-black mr-0">
{accountName}
</span>
</li>
Expand Down

0 comments on commit 711737c

Please sign in to comment.