Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
Added container and RTL stuff and updated related styles. (#967)
Browse files Browse the repository at this point in the history
  • Loading branch information
asangma committed May 13, 2020
1 parent f5956fb commit 57f326a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 20 deletions.
35 changes: 22 additions & 13 deletions src/components/calcite-action-pad/calcite-action-pad.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
:host {
@extend %component-host;
display: inline-flex;
flex-direction: column;
box-shadow: var(--calcite-app-shadow-2);
max-width: 15vw;
overflow-y: auto;
animation: calcite-app-fade-in var(--calcite-app-animation-time-fast) var(--calcite-app-easing-function);
}

Expand All @@ -20,6 +15,14 @@
padding-top: 0;
}

.container {
display: inline-flex;
flex-direction: column;
box-shadow: var(--calcite-app-shadow-2);
max-width: 15vw;
overflow-y: auto;
}

.action-group--bottom {
padding-bottom: 0;
flex-grow: 1;
Expand All @@ -28,16 +31,22 @@

:host([layout="horizontal"], [expanded]),
:host([layout="horizontal"]) {
flex-direction: row;
max-width: unset;
::slotted(calcite-action-group) {
border-right: 1px solid var(--calcite-app-border);
border-bottom: none;
.container {
flex-direction: row;
padding: 0;
max-width: unset;
.action-group--bottom {
padding: 0;
}
::slotted(calcite-action-group) {
border-right: 1px solid var(--calcite-app-border);
border-bottom: none;
flex-direction: row;
padding: 0;
}
}
.action-group--bottom {
padding: 0;
.container.calcite--rtl ::slotted(calcite-action-group) {
border-right: none;
border-left: 1px solid var(--calcite-app-border);
}
}

Expand Down
14 changes: 12 additions & 2 deletions src/components/calcite-action-pad/calcite-action-pad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
} from "@stencil/core";
import { CalciteLayout, CalcitePosition, CalciteTheme } from "../interfaces";
import { CalciteExpandToggle, toggleChildActionText } from "../utils/CalciteExpandToggle";
import { getElementDir } from "../utils/dom";
import { CSS_UTILITY } from "../utils/resources";
import { CSS, TEXT } from "./resources";

/**
Expand Down Expand Up @@ -165,10 +167,18 @@ export class CalciteActionPad {
}

render(): VNode {
const rtl = getElementDir(this.el) === "rtl";
const containerClasses = {
[CSS.container]: true,
[CSS_UTILITY.rtl]: rtl
}

return (
<Host>
<slot />
{this.renderBottomActionGroup()}
<div class={containerClasses}>
<slot />
{this.renderBottomActionGroup()}
</div>
</Host>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/calcite-action-pad/resources.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const CSS = {
actionGroupBottom: "action-group--bottom"
actionGroupBottom: "action-group--bottom",
container: "container"
};

export const TEXT = {
Expand Down
34 changes: 30 additions & 4 deletions src/demos/action-pad/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,47 @@ <h1>calcite-action-pad horizontal</h1>

<div class="action-pad-container">
<calcite-action-pad layout="horizontal">
<calcite-action-group layout="horizontal">
<calcite-action-group>
<calcite-action text="Undo" icon="undo"> </calcite-action>
<calcite-action text="Redo" icon="redo"> </calcite-action>
</calcite-action-group>
<calcite-action-group layout="horizontal">
<calcite-action-group>
<calcite-action text="Title" icon="title"></calcite-action>
<calcite-action text="Text" icon="text"></calcite-action>
<calcite-action text="Bold" icon="bold"></calcite-action>
<calcite-action text="Italics" icon="italicize"></calcite-action>
</calcite-action-group>
<calcite-action-group layout="horizontal">
<calcite-action-group>
<calcite-action text="Cut" icon="scissors"></calcite-action>
<calcite-action text="Add" icon="plus-square"></calcite-action>
</calcite-action-group>
<calcite-action-group layout="horizontal">
<calcite-action-group>
<calcite-action text="Remove" icon="trash"> </calcite-action>
</calcite-action-group>
</calcite-action-pad>
</div>
</section>

<section class="example-container" >
<h1>RTL : calcite-action-pad horizontal</h1>

<div class="action-pad-container" dir="rtl">
<calcite-action-pad layout="horizontal">
<calcite-action-group>
<calcite-action text="Undo" icon="undo"> </calcite-action>
<calcite-action text="Redo" icon="redo"> </calcite-action>
</calcite-action-group>
<calcite-action-group>
<calcite-action text="Title" icon="title"></calcite-action>
<calcite-action text="Text" icon="text"></calcite-action>
<calcite-action text="Bold" icon="bold"></calcite-action>
<calcite-action text="Italics" icon="italicize"></calcite-action>
</calcite-action-group>
<calcite-action-group>
<calcite-action text="Cut" icon="scissors"></calcite-action>
<calcite-action text="Add" icon="plus-square"></calcite-action>
</calcite-action-group>
<calcite-action-group>
<calcite-action text="Remove" icon="trash"> </calcite-action>
</calcite-action-group>
</calcite-action-pad>
Expand Down

0 comments on commit 57f326a

Please sign in to comment.