-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add components for side menu layout #149
- Loading branch information
Showing
6 changed files
with
102 additions
and
19 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,25 @@ | ||
import WComponent, { DOM, AttributeParser, getWTagName } from "../../../WComponent.js"; | ||
const stylesheet=` | ||
:host{} | ||
`; | ||
class SideMenu extends WComponent{ | ||
static attributes = { | ||
position: { | ||
name: 'position', defaultValue: 'left', | ||
parser: (value, attr) => AttributeParser.parseStringAttr( | ||
value, attr.defaultValue, /^left$|^right$/ | ||
) | ||
} | ||
}; | ||
static get observedAttributes() { | ||
return this.getObservedAttributes(this.attributes); | ||
} | ||
constructor(){ | ||
super(); | ||
} | ||
init(){ | ||
DOM.create("slot", {}, this.shadowRoot); | ||
} | ||
} | ||
SideMenu.prototype.stylesheet=stylesheet; | ||
export default SideMenu; |
18 changes: 18 additions & 0 deletions
18
packages/w-components/components/layout/menu/SideMenuContent.js
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,18 @@ | ||
import WComponent, { DOM, AttributeParser, getWTagName } from "../../../WComponent.js"; | ||
const stylesheet=` | ||
:host{} | ||
`; | ||
class SideMenuContent extends WComponent{ | ||
static attributes = {}; | ||
static get observedAttributes() { | ||
return this.getObservedAttributes(this.attributes); | ||
} | ||
constructor(){ | ||
super(); | ||
} | ||
init(){ | ||
DOM.create("slot", {}, this.shadowRoot); | ||
} | ||
} | ||
SideMenuContent.prototype.stylesheet=stylesheet; | ||
export default SideMenuContent; |
45 changes: 45 additions & 0 deletions
45
packages/w-components/components/layout/menu/SideMenuLayout.js
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,45 @@ | ||
import WComponent, { DOM, AttributeParser, getWTagName } from "../../../WComponent.js"; | ||
const stylesheet=` | ||
:host{ | ||
display:flex; | ||
} | ||
:host>::slotted(w-sidemenu){ | ||
flex:none;order:1; | ||
width:150px;height:calc(100vh - 100px);position:sticky;top:80px; | ||
left:0px;right:auto; | ||
padding:10px 15px;border-left:none;border-right:1px solid #cccccc; | ||
} | ||
:host([position='right'])>::slotted(w-sidemenu){ | ||
order:2; | ||
left:auto;right:0px; | ||
border-left:1px solid #cccccc;border-right:none; | ||
} | ||
:host>::slotted(w-sidemenu-content){ | ||
order:2; | ||
flex:auto;padding:15px 20px; | ||
} | ||
:host([position='right'])>::slotted(w-sidemenu-content){ | ||
order:1; | ||
} | ||
`; | ||
class SideMenuLayout extends WComponent{ | ||
static attributes = { | ||
position: { | ||
name: 'position', defaultValue: 'left', | ||
parser: (value, attr) => AttributeParser.parseStringAttr( | ||
value, attr.defaultValue, /^left$|^right$/ | ||
) | ||
} | ||
}; | ||
static get observedAttributes() { | ||
return this.getObservedAttributes(this.attributes); | ||
} | ||
constructor(){ | ||
super(); | ||
} | ||
init(){ | ||
DOM.create("slot", {}, this.shadowRoot); | ||
} | ||
} | ||
SideMenuLayout.prototype.stylesheet=stylesheet; | ||
export default SideMenuLayout; |
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