Skip to content

Commit

Permalink
feat: Introduce Dialog as successor for Modal - Fiori 3 refactor (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
salarenko committed Feb 21, 2020
1 parent 35b42c0 commit 704de9b
Show file tree
Hide file tree
Showing 43 changed files with 856 additions and 514 deletions.
6 changes: 3 additions & 3 deletions docs/_data/components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
- title: Button
meta: button

- title: Dialog
meta: dialog

- title: Forms
meta: form

Expand Down Expand Up @@ -45,9 +48,6 @@
- title: Message Strip
meta: message-strip

- title: Modal
meta: modal

- title: Notification
meta: notification

Expand Down
10 changes: 5 additions & 5 deletions docs/_data/sidebars/left-navigation-sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ entries:
url: /components/calendar.html
output: web

- title: Dialog
url: /components/dialog.html
output: web

- title: Forms
url: /components/form.html
output: web
Expand Down Expand Up @@ -176,10 +180,6 @@ entries:
url: /components/message-strip.html
output: web

- title: Modal
url: /components/modal.html
output: web

- title: Notification
url: /components/notification.html
output: web
Expand Down Expand Up @@ -211,7 +211,7 @@ entries:
- title: Status Indicators
url: /components/status-indicators.html
output: web

- title: Switch
url: /components/switch.html
output: web
Expand Down
17 changes: 0 additions & 17 deletions docs/_includes/demo-page-components/modal-app-overlay.html

This file was deleted.

2 changes: 1 addition & 1 deletion docs/_sass/_docs-component-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ $grid-transition-delay: 100ms;
margin-top: 50px;
}

&__modal {
&__dialog {
width: 230px;
margin-top: 0;
}
Expand Down
20 changes: 20 additions & 0 deletions docs/_sass/_docs-display-component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,26 @@
text-decoration: none;
}

.fd-dialog-docs-static {
&.fd-dialog,
.fd-dialog {
position: static;
background-color: transparent;
}

&.fd-dialog__content,
.fd-dialog__content{
position: static;
transform: translate(0%, 0%);
width: 30rem;
margin: auto;

&:not(:last-child) {
margin-bottom: 2rem;
}
}
}

&__app {
height: 500px;
color: fd-color(text, 5);
Expand Down
File renamed without changes
34 changes: 32 additions & 2 deletions docs/js/customscripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ $(document).ready(function () {
});

$(document).ready(function () {
//dialog
draggableDialog();

//dropdown
var els = document.querySelectorAll("[aria-controls]");
for (var i = 0; i < els.length; i++) {
Expand Down Expand Up @@ -83,6 +86,7 @@ $(document).ready(function () {
group.classList.remove('is-hidden');
}
}

var isPressed;
//handle the primary trigger
if (isTree || isTreeItem) {
Expand Down Expand Up @@ -116,6 +120,7 @@ $(document).ready(function () {
}
return block;
}

//get all tablists
var tablists = document.querySelectorAll('[role="tablist"]');
//handle each tablist
Expand Down Expand Up @@ -209,7 +214,7 @@ $(document).ready(function () {

const triStateCheckboxI8 = document.getElementById('Ai4ez6191');
if (triStateCheckboxI8) {
triStateCheckboxI8.indeterminate = true;
triStateCheckboxI8.indeterminate = true;
}

// display responsive component controls
Expand Down Expand Up @@ -251,7 +256,7 @@ function stepInputValue(inputId, stepDirection) {
let inputRef = document.getElementById(inputId);

if (inputRef) {
if(stepDirection === "up") {
if (stepDirection === "up") {
++inputRef.value;
} else if (stepDirection === "down") {
--inputRef.value;
Expand All @@ -261,3 +266,28 @@ function stepInputValue(inputId, stepDirection) {
}
}

function toggleDialog(dialogId, show) {
let dialog = document.getElementById(dialogId);
if (show) {
$(dialog).addClass("fd-dialog--active")
} else {
$(dialog).removeClass("fd-dialog--active")
}
}


function draggableDialog() {
let draggableDialogs = document.getElementsByClassName('fd-dialog__content--draggable-grab');

for (let i = 0; i < draggableDialogs.length; i++) {
let dialogHeader = draggableDialogs[i].getElementsByClassName('fd-dialog__header')[0];
if (dialogHeader) {
dialogHeader.onmousedown = function () {
$(draggableDialogs[i]).addClass('fd-dialog__content--draggable-grabbing');
};
dialogHeader.onmouseup = function () {
$(draggableDialogs[i]).removeClass('fd-dialog__content--draggable-grabbing');
};
}
}
}
2 changes: 1 addition & 1 deletion docs/pages/components/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ folder: components

Buttons allow users to perform actions.
{: .docs-intro}
The priority of buttons within a page should be considered. For instance, only use the main button once within a page or modal.
The priority of buttons within a page should be considered. For instance, only use the main button once within a page or dialog.
Color is also important. For instance, the most important button has a blue background where as a red button should only be used if the action it performs is potentially destructive.

<br>
Expand Down

0 comments on commit 704de9b

Please sign in to comment.