Skip to content

Commit

Permalink
Сделал экспорт ссылки на заметку в соц сети
Browse files Browse the repository at this point in the history
  • Loading branch information
YarikMix committed May 18, 2024
1 parent 11a7554 commit 12af1b7
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 4 deletions.
Binary file modified public/src/assets/odnoklassniki.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/src/assets/viber.png
Binary file not shown.
Binary file modified public/src/assets/vk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/src/assets/whatsapp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions public/src/components/SharePanel/SharePanel.sass
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
.social-icon
cursor: pointer
transition: 0.2s
width: 40px
height: 40px

&:hover
transform: scale(1.1)
33 changes: 29 additions & 4 deletions public/src/components/SharePanel/SharePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,34 @@ import {Button} from "../Button/Button";
import "./SharePanel.sass"
import {ToggleButton} from "../ToggleButton/ToggleButton";
import {Img} from "../Image/Image";
import {AppNotesStore} from "../../modules/stores/NotesStore";
import {parseNoteTitle} from "../../modules/utils";

export class SharePanel extends ScReact.Component<any, any> {

shareToVK = () => {
const url = "https://vk.com/share.php?url=" + window.location.href + "&title=" + parseNoteTitle(AppNotesStore.state.selectedNote.title)
this.openShareWindow(url)
}

shareToOdnoklassniki = () => {
const url = "https://connect.ok.ru/offer?url=" + window.location.href + "&title=" + parseNoteTitle(AppNotesStore.state.selectedNote.title)
this.openShareWindow(url)
}

shareToWhatsApp = () => {
const url = "https://wa.me/?text=" + window.location.href
this.openShareWindow(url)
}

openShareWindow = (url:string) => {
const width = 800, height = 500;
const left = (window.screen.width - width) / 2;
const top = (window.screen.height - height) / 2;
const social_window = window.open(url, "share_window", "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left);
social_window.focus();
}

render() {
return (
<div className="share_panel">
Expand All @@ -27,10 +53,9 @@ export class SharePanel extends ScReact.Component<any, any> {
<div className="share_panel__social-btns-container">
<h3>Поделиться через соц. сети</h3>
<div className="share_panel__social-btns-container__bottom-container">
<Img src="vk.png" className="social-icon"/>
<Img src="odnoklassniki.png" className="social-icon" />
<Img src="whatsapp.png" className="social-icon" />
<Img src="viber.png" className="social-icon" />
<Img src="vk.png" className="social-icon" onClick={this.shareToVK}/>
<Img src="odnoklassniki.png" className="social-icon" onClick={this.shareToOdnoklassniki} />
<Img src="whatsapp.png" className="social-icon" onClick={this.shareToWhatsApp} />
</div>
</div>
</div>
Expand Down

0 comments on commit 12af1b7

Please sign in to comment.