Skip to content

Commit

Permalink
fix buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Nora01K committed Jul 1, 2024
1 parent aaaa4da commit 001e49e
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions src/components/modals/ModalCreatePost.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@
let text: string = '';
let repostId = '';
let highlightedButton = '';
let oldButton = '';
interface BodyData {
content: string;
location?: GeoLocationCoords;
repostedPostId?: string;
}
const highlightedButton = 'p-2 variant-filled-secondary';
const notHighlightedButton = 'p-2';
let buttonTextCss = highlightedButton;
let buttonImageCss = notHighlightedButton;
let files: FileList;
let pictureSet: boolean = false;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -43,21 +39,17 @@
if (!textClick) {
textClick = true;
}
highlightedButton = document.getElementById(1);
oldButton = document.getElementById(2);
highlightedButton?.classList.add('variant-filled-secondary');
oldButton?.classList.remove('variant-filled-secondary');
buttonTextCss = highlightedButton;
buttonImageCss = notHighlightedButton;
imageClick = false;
}
function clickImage() {
if (!imageClick) {
imageClick = true;
}
highlightedButton = document.getElementById(2);
oldButton = document.getElementById(1);
highlightedButton?.classList.add('variant-filled-secondary');
oldButton?.classList.remove('variant-filled-secondary');
buttonImageCss = highlightedButton;
buttonTextCss = notHighlightedButton;
textClick = false;
}
Expand Down Expand Up @@ -85,8 +77,10 @@
<div class="card w-[40vw]">
<header class="card-header flex justify-center items-center">
<div class="w-min flex justify-center outline-none border-none">
<button id="1" class="p-2" on:click={clickText}>{$t('modalCreatePost.header.Text')}</button>
<button id="2" class="p-2" on:click={clickImage}
<button id="1" class={buttonTextCss} on:click={clickText}
>{$t('modalCreatePost.header.Text')}</button
>
<button id="2" class={buttonImageCss} on:click={clickImage}
>{$t('modalCreatePost.header.Image')}</button
>
</div>
Expand Down

0 comments on commit 001e49e

Please sign in to comment.