Skip to content

Commit

Permalink
Refactor FrameButton component to update close button styling and add…
Browse files Browse the repository at this point in the history
… dismiss button functionality
  • Loading branch information
Adammatthiesen committed Dec 22, 2024
1 parent c015715 commit 13c850d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/studiocms_dashboard/src/components/FrameButton.astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ const { link } = Astro.props;
class FrameButton extends HTMLElement {
constructor() {
super();
const text = this.getAttribute('data-text') || 'Click me';

// Get the slot element
const slot = document.createElement('slot');

Expand All @@ -40,7 +38,7 @@ const { link } = Astro.props;
frameButton.style.position = 'absolute';
frameButton.style.top = '1rem';
frameButton.style.right = '1rem';
frameButton.style.backgroundColor = 'hsl(var(--background-step-3))';
frameButton.style.backgroundColor = 'transparent';
frameButton.style.color = 'white';
frameButton.style.padding = '0.5rem';
frameButton.style.border = 'none';
Expand All @@ -51,6 +49,15 @@ const { link } = Astro.props;
frameButton.style.display = 'flex';
frameButton.style.justifyContent = 'center';
frameButton.style.alignItems = 'center';
frameButton.classList.add('dismiss-button');

frameButton.addEventListener('mouseenter', () => {
frameButton.style.backgroundColor = 'hsl(var(--background-step-2));';
});

frameButton.addEventListener('mouseleave', () => {
frameButton.style.backgroundColor = 'transparent';
});

frameButton.addEventListener('click', () => {
frameContainer.style.display = 'none';
Expand All @@ -74,7 +81,7 @@ const { link } = Astro.props;

console.log('clicked');

const link = this.getAttribute('data-link');
const link = this.getAttribute('data-link')!;
const linkResponse = await fetch(link);

const jsonRes = await linkResponse.json();
Expand Down

0 comments on commit 13c850d

Please sign in to comment.