Skip to content

Commit 9eda4eb

Browse files
[#148] Adding style and moving origonal style over to TW
1 parent 3d38fd5 commit 9eda4eb

File tree

3 files changed

+46
-77
lines changed

3 files changed

+46
-77
lines changed
Lines changed: 27 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,29 @@
1-
/* .acf-block-dialog {
2-
position: absolute;
3-
top: 0;
4-
left: 50%;
5-
transform: translate(-50%, 0);
6-
width: 75vw;
7-
max-height: 60vh;
8-
display: none;
9-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
10-
z-index: 800;
11-
overflow: auto;
12-
}
13-
.acf-block-dialog .inner {
14-
padding: 1.5rem 2rem;
15-
position: relative;
16-
}
17-
.acfbt-dialog-close {
18-
position: absolute;
19-
top: 0;
20-
right: 0;
21-
padding: 0.35rem 0.75rem;
22-
cursor: pointer;
23-
text-transform: uppercase;
24-
font-size: 1rem;
25-
display: flex;
26-
gap: 0.25rem;
27-
}
28-
.acfbt-dialog-close::before {
29-
content: '×';
30-
font-size: 1.5rem;
31-
line-height: 0.85;
32-
font-weight: lighter;
33-
}
34-
.acfbt-dialog-label {
35-
display: block;
36-
cursor: pointer;
37-
}
38-
.acfbt-dialog-checkbox {
39-
position: absolute;
40-
visibility: hidden;
41-
width: 0;
42-
height: 0;
43-
overflow: hidden;
44-
opacity: 0;
45-
}
46-
input:checked + label + .acf-block-dialog {
47-
display: block;
48-
}
1+
@layer components {
2+
.acf-block-dialog {
3+
@apply relative !border !border-black;
4+
.inner {
5+
@apply relative p-24;
6+
}
497

50-
.is-root-container:has(.acf-block-dialog) {
51-
position: relative;
52-
}
8+
.acfbt-dialog-close {
9+
@apply absolute right-12 top-12 z-50 m-auto size-32 cursor-pointer border border-none border-black bg-transparent hover:bg-black;
10+
@apply after:flex after:items-center after:justify-center after:text-black after:content-['\2715'] hover:after:text-white;
11+
}
12+
}
13+
14+
.acfbt-dialog-label {
15+
@apply block cursor-pointer;
16+
}
5317

18+
.acfbt-dialog-checkbox {
19+
@apply sr-only;
20+
}
21+
22+
input:checked + label + div .acf-block-dialog {
23+
@apply block w-2/3;
24+
}
25+
26+
.is-root-container:has(.acf-block-dialog) {
27+
@apply relative;
28+
}
29+
}

wp-content/themes/wp-starter/blocks/dialog/render.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
*/
99

1010
$cbx_id = uniqid();
11+
1112
?>
1213
<?php if ( is_admin() ) : ?>
1314
<input type="checkbox" id="<?php echo esc_attr( $cbx_id ); ?>" class="acfbt-dialog-checkbox">
14-
<label for="<?php echo esc_attr( $cbx_id ); ?>" class="acfbt-dialog-label"><?php esc_html_e( 'Toggle', 'wp-site-starter' ); ?></label>
15+
<label for="<?php echo esc_attr( $cbx_id ); ?>" class="acfbt-dialog-label"><?php esc_html_e( 'Toggle Dialog', 'wp-site-starter' ); ?></label>
1516
<?php endif; ?>
1617

1718
<div
@@ -27,7 +28,6 @@
2728
// Delay close to allow for animation
2829
handleDialogClose() {
2930
if (!this.openDialog) return
30-
3131
this.openDialog = false
3232
$refs.dialogRef.close()
3333
}
@@ -45,19 +45,23 @@
4545
>
4646
<?php if ( ! is_admin() ) : ?>
4747
<button
48+
class="acf-dialog-close"
4849
@click="handleDialogClose()"
4950
>
50-
<?php esc_html_e( 'Close', 'wp-site-starter' ); ?>
51+
<span class="sr-only"><?php esc_html_e( 'Close', 'wp-site-starter' ); ?></span>
5152
</button>
5253
<?php endif; ?>
5354

5455
<div class="inner">
5556
<?php if ( is_admin() ) : ?>
56-
<label for="<?php echo esc_attr( $cbx_id ); ?>" class="acfbt-dialog-close"><?php esc_html_e( 'Close', 'wp-site-starter' ); ?></label>
57+
<label for="<?php echo esc_attr( $cbx_id ); ?>" class="acfbt-dialog-close">
58+
<span class="sr-only"><?php esc_html_e( 'Close', 'wp-site-starter' ); ?></span>
59+
</label>
5760
<?php endif; ?>
5861
<?php inner_blocks(); ?>
5962
</div>
6063
</dialog>
64+
6165
<button
6266
class="btn-default"
6367
<?php if ( ! is_admin() ) : ?>
Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,23 @@
11
@layer components {
22
html:has(.acf-block-dialog[open]),
33
body:has(.acf-block-dialog[open]) {
4-
overflow: hidden;
4+
@apply overflow-hidden;
55
}
66

77
.acf-block-dialog {
8-
border-radius: 0;
9-
border: none;
10-
background: white;
11-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
12-
}
13-
14-
.acf-block-dialog::backdrop {
15-
@apply bg-black/40;
16-
}
8+
@apply bottom-0 left-0 right-0 top-0 !m-auto h-1/2 w-1/2 rounded border-none bg-white;
179

18-
.acf-block-dialog[open],
19-
.acf-block-dialog::backdrop {
20-
animation: show 500ms ease;
21-
}
10+
&::backdrop {
11+
@apply bg-black/70;
12+
}
2213

23-
.acf-block-dialog > .inner {
24-
padding: 50px;
25-
display: flex;
26-
flex-direction: column;
27-
}
14+
.acf-dialog-close {
15+
@apply absolute right-12 top-12 z-10 m-auto size-32 cursor-pointer border border-none border-black bg-transparent hover:bg-black;
16+
@apply after:flex after:items-center after:justify-center after:text-black after:content-['\2715'] hover:after:text-white;
17+
}
2818

29-
@keyframes show {
30-
0% {
31-
opacity: 0;
19+
> .inner {
20+
@apply flex flex-col p-24;
3221
}
3322
}
3423
}

0 commit comments

Comments
 (0)