Skip to content

Commit 7a4785c

Browse files
committed
US206196 code review changes
* updated documentation for triggers and the two events (openModal, closeModal) * simplified sass padding
1 parent bd693c6 commit 7a4785c

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

elements/pfe-modal/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
## Slots
2020

2121
### Trigger
22-
The only part visible on page load, the trigger opens the modal window. The trigger can be a button, a cta or a link.
22+
The only part visible on page load, the trigger opens the modal window. The trigger can be a button, a cta or a link. While it is part of the modal web component, it does not contain any intrinsic styles.
2323

2424
### Header
2525
The header is an optional slot that appears at the top of the modal window. It should be a header tag (h2-h6).
@@ -30,12 +30,12 @@ The default slot can contain any type of content. When the header is not present
3030
## Events
3131

3232
### openModal
33-
Fires when a user clicks on the trigger.
33+
Fires when a user clicks on the trigger. openModal can be accessed from outside the web component by getting the modal that you want to fire and passing in the firing event: `document.querySelector("pfe-modal#custom-id").openModal(event).`
3434

3535
### closeModal
36-
Fires when either a user clicks on either the close button or the overlay.
37-
36+
Fires when either a user clicks on either the close button or the overlay. closeModal can be accessed from outside the web component by getting the modal that you want to fire and passing in the firing event: `document.querySelector("pfe-modal#custom-id").closeModal(event).`
3837

38+
### Dependencies
3939
Make sure you have [Polyserve][polyserve] and [Web Component Tester][web-component-tester] installed.
4040

4141
npm install -g polyserve web-component-tester

elements/pfe-modal/src/pfe-modal.scss

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ $pfe-modal--breakpoint--medium: 640px;
99
--pfe-modal--MaxWidth--mobile: 94vw;
1010
--pfe-modal--MaxHeight: 90vh;
1111
--pfe-modal--Padding: calc(#{pfe-var(container-padding)} * 2) 0 calc(#{pfe-var(container-padding)} * 2) calc(#{pfe-var(container-padding)} * 2);
12-
--pfe-modal--Padding--mobile: 0 0 0 calc(#{pfe-var(container-padding)} * 2);
1312
--pfe-modal__overlay--BackgroundColor: #{pfe-color(overlay)};
14-
--pfe-modal--CloseButtonSize: calc(#{pfe-var(ui--element--size)} - 4px);
13+
--pfe-modal--close--size: calc(#{pfe-var(ui--element--size)} - 4px);
1514
display: block;
1615
position: relative;
17-
}
1816

19-
:host(:not([has_header])) {
20-
--pfe-modal--Padding: calc(#{pfe-var(container-padding)} * 2) calc(#{pfe-var(container-padding)} * 4) calc(#{pfe-var(container-padding)} * 2) calc(#{pfe-var(container-padding)} * 2);
17+
@media screen and (max-height: $pfe-modal--breakpoint--medium) {
18+
--pfe-modal--Padding: 0 0 0 calc(#{pfe-var(container-padding)} * 2);
19+
}
2120
}
2221

2322
.pfe-modal {
@@ -69,24 +68,13 @@ $pfe-modal--breakpoint--medium: 640px;
6968
position: relative;
7069
max-width: calc(100% - #{pfe-var(ui--element--size)});
7170
max-height: inherit;
72-
padding: var(--pfe-modal--Padding);
73-
74-
@media screen and (max-height: $pfe-modal--breakpoint--medium) {
75-
padding: var(--pfe-modal--Padding--mobile);
76-
}
71+
padding: pfe-local(Padding);
7772

7873
&[hidden] {
7974
display: none;
8075
}
8176

8277
:host(:not([has_header])) & {
83-
@media screen and (min-width: $pfe-modal--breakpoint--medium) {
84-
padding: calc(#{pfe-var(container-padding)} * 2) calc(#{pfe-var(container-padding)} * 6) calc(#{pfe-var(container-padding)} * 2) calc(#{pfe-var(container-padding)} * 2);
85-
}
86-
87-
@media screen and (max-height: $pfe-modal--breakpoint--medium) and (min-width: $pfe-modal--breakpoint--medium) {
88-
padding: 0 0 calc(#{pfe-var(container-padding)} * 2) calc(#{pfe-var(container-padding)} * 2);
89-
}
9078

9179
// Remove margin-top on the first slotted element that is not the header.
9280
::slotted(*:nth-child(1)),
@@ -135,8 +123,8 @@ $pfe-modal--breakpoint--medium: 640px;
135123
fill: pfe-radio(text);
136124
height: pfe-var(ui--element--size);
137125
width: pfe-var(ui--element--size);
138-
height: pfe-local(CloseButtonSize);
139-
width: pfe-local(CloseButtonSize);
126+
height: pfe-local(close--size);
127+
width: pfe-local(close--size);
140128
}
141129
}
142130
}

0 commit comments

Comments
 (0)