Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/frontend/app/logo.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { React, useTypedRedux } from "../app-framework";6import { APP_ICON } from "../art";7import { appBasePath } from "@cocalc/frontend/customize/app-base-path";8import { A } from "@cocalc/frontend/components/A";9import { Tooltip } from "antd";1011const STYLE: React.CSSProperties = {12display: "inline-block",13backgroundSize: "contain",14backgroundRepeat: "no-repeat",15position: "relative",16} as const;1718interface Props {19size: number;20}2122export const AppLogo: React.FC<Props> = React.memo((props: Props) => {23const { size } = props;24const marginVal = Math.max(1, Math.round(size / 20));25const margin = `${marginVal}px`;26const dimension = `${size - 2 * marginVal}px`;2728const logo_square: string | undefined = useTypedRedux(29"customize",30"logo_square"31);3233const backgroundImage = `url('${logo_square ? logo_square : APP_ICON}')`;3435return (36<A37href={appBasePath}38style={{39height: dimension,40width: dimension,41margin: margin,42display: "inline-block",43}}44>45<Tooltip46title="Open the main website in a new tab."47mouseEnterDelay={1}48mouseLeaveDelay={0}49placement="right"50>51<div52style={{53...STYLE,54height: dimension,55width: dimension,56backgroundImage,57}}58></div>59</Tooltip>60</A>61);62});636465