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/components/hidden-visible.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45// See https://getbootstrap.com/docs/3.3/css/67import { CSSProperties, ReactNode } from "react";89// Antd has a rule that puts an 8px margin on the left of all spans in antd buttons,10// which means that when these buttons get hidden they take up 8px of empty space11// (since the span is still there). So for now we workaround this with an explicit style12// that cancels this out.13const STYLE = { marginLeft: 0 } as const;1415interface Props {16children?: ReactNode;17style?: CSSProperties;18}1920// HiddenXS = hide if width < 768px21export function HiddenXS({ children, style }: Props) {22return (23<span style={{ ...STYLE, ...style }} className={"hidden-xs"}>24{children}25</span>26);27}2829export function HiddenSM({ children, style }: Props) {30return (31<span style={{ ...STYLE, ...style }} className={"hidden-sm"}>32{children}33</span>34);35}3637export function HiddenXSSM({ children, style }: Props) {38return (39<span style={{ ...STYLE, ...style }} className={"hidden-xs hidden-sm"}>40{children}41</span>42);43}4445// VisibleMDLG = visible on medium or large devices (anything with width > 992px)46export function VisibleMDLG({ children, style }: Props) {47return (48<span49style={{ ...STYLE, ...style }}50className={"visible-md-inline visible-lg-inline"}51>52{children}53</span>54);55}5657// VisibleMDLG = visible on medium or large devices (anything with width > 992px)58export function VisibleLG({ children, style }: Props) {59return (60<span style={{ ...STYLE, ...style }} className={"visible-lg-inline"}>61{children}62</span>63);64}6566export function VisibleXSSM({ children, style }: Props) {67return (68<span69style={{ ...STYLE, ...style }}70className={"visible-xs-inline visible-sm-inline"}71>72{children}73</span>74);75}7677export function VisibleXS({ children, style }: Props) {78return (79<span style={{ ...STYLE, ...style }} className={"visible-xs-inline"}>80{children}81</span>82);83}848586