-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #224 from ably/edx-371-dropdown-menu
[EDX-371] Dropdown menu component
- Loading branch information
Showing
19 changed files
with
393 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
cypress/integration/core/dropdown_menu/__snapshots__/snapshot.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
exports[`Flash Snapshot Test > renders correcty #0`] = ` | ||
<div id="dropdown-menu" class="relative"> | ||
<button | ||
id="menu-trigger" | ||
class="text-h3 flex items-center p-8 ml-8 group hover:text-gui-hover hover:bg-light-grey active:text-gui-active focus:text-gui-focus focus:outline-none rounded-lg" | ||
> | ||
<span class="leading-normal">Dropdown Menu Trigger</span | ||
><svg | ||
class="text-cool-black transform rotate-90 group-hover:text-gui-hover group-active:text-gui-active group-focus:text-gui-focus" | ||
style="width: 1.25rem; height: 1.25rem;" | ||
> | ||
<use xlink:href="#sprite-icon-gui-disclosure-arrow"></use> | ||
</svg> | ||
</button> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
describe("Dropdown Menu", () => { | ||
describe("Menu Trigger", () => { | ||
it("should open when clicked", () => { | ||
cy.viewport("macbook-16"); | ||
|
||
cy.visit("/components/dropdown-menu") | ||
.get("#dropdown-menu") | ||
.contains("Dropdown Menu Trigger") | ||
.click() | ||
.get("#menu-content") | ||
.contains("Using plain HTML"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { fixSnapshotSpec } from "../../../support"; | ||
|
||
beforeEach(fixSnapshotSpec(__filename)); | ||
|
||
describe("Flash Snapshot Test", () => { | ||
beforeEach(() => { | ||
cy.visit("/components/dropdown-menu"); | ||
cy.viewport("macbook-16"); | ||
}); | ||
|
||
it("renders correcty", () => { | ||
const dropdownMenuId = "#dropdown-menu"; | ||
cy.get(dropdownMenuId).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module AblyUi | ||
VERSION = '8.7.0.dev.b3aa10e' | ||
VERSION = '8.7.0.dev.24cbbe4' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// We disable this rule here because we are linking to the same domain | ||
/* eslint-disable react/jsx-no-target-blank */ | ||
import React from "react"; | ||
import Icon from "@ably/ui/core/Icon"; | ||
|
||
import DropdownMenu from "@ably/ui/core/DropdownMenu"; | ||
|
||
import { renderComponent } from "@ably/ui/core/scripts"; | ||
|
||
document.addEventListener("DOMContentLoaded", () => { | ||
const DropdownMenuPreview = () => { | ||
return ( | ||
<DropdownMenu> | ||
<DropdownMenu.Trigger additionalTriggerCSS="text-h3"> | ||
Dropdown Menu Trigger | ||
</DropdownMenu.Trigger> | ||
<DropdownMenu.Content anchorPosition="left"> | ||
<DropdownMenu.Link | ||
url="https://ably.com/" | ||
title="Using DropdownMenuLink Component" | ||
subtitle="This is using the inbuilt component which takes props for title, subtitle, icon name & children." | ||
iconName="icon-gui-link-arrow" | ||
> | ||
<p className="text-p3">I am a child! 🐣</p> | ||
</DropdownMenu.Link> | ||
<DropdownMenu.Link | ||
url="https://ably.com/" | ||
title="Using DropdownMenuLink Component - no icon, subtitle or children" | ||
/> | ||
<a | ||
href="https://ably.com/docs" | ||
target="_blank" | ||
className="group block p-8 hover:bg-light-grey hover:text-cool-black rounded" | ||
> | ||
<p className="ui-featured-link group-hover:text-gui-hover font-light text-cool-black"> | ||
Using plain HTML | ||
<Icon | ||
name="icon-gui-link-arrow" | ||
size="1rem" | ||
color="text-cool-black" | ||
additionalCSS="ui-featured-link-icon group-hover:text-gui-hover group-active:text-gui-active group-focus:text-gui-focus" | ||
/> | ||
</p> | ||
</a> | ||
</DropdownMenu.Content> | ||
</DropdownMenu> | ||
); | ||
}; | ||
|
||
const node = document.querySelector("#dropdown-menu-container"); | ||
renderComponent(DropdownMenuPreview, {}, node); | ||
}); |
Oops, something went wrong.