@emotion/react#css JavaScript Examples
The following examples show how to use
@emotion/react#css.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: theme-switcher.js From velocitypowered.com with MIT License | 6 votes |
export default function ThemeSwitcher({ themeName, setThemeName }) {
if (typeof themeName === 'undefined') return null
const checked = themeName === "light"
function flipTheme() {
if (themeName === "light") {
setThemeName("dark")
} else {
setThemeName("light")
}
}
return <div>
<Switch onChange={flipTheme}
checked={checked}
offColor={"#222"}
onColor={"#fff"}
onHandleColor={"#0288d1"}
offHandleColor={"#0288d1"}
uncheckedIcon={
<FiMoon css={iconCommonCss} />
}
checkedIcon={
<FiSun css={iconCommonCss} color={"#222"} />
}
role="switch"
aria-checked={String(checked)}
aria-label={checked ? "Toggle dark theme" : "Toggle light theme"}
/>
</div>
}
Example #2
Source File: _globalStyles.js From aava.sh with MIT License | 6 votes |
globalCss = (props) => css`
html, body {
margin: 0px;
background-color: ${props.colors.backgroundColor};
}
* {
box-sizing: border-box;
}
a {
color: inherit;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
`
Example #3
Source File: globalStyles.js From twin.macro with MIT License | 6 votes |
MyGlobals = () => (
<div>
<Global
styles={css`
body {
background: red;
}
`}
/>
<GlobalStyles />
</div>
)
Example #4
Source File: _app.js From benjamincarlson.io with MIT License | 6 votes |
GlobalStyle = ({ children }) => {
const { colorMode } = useColorMode()
return (
<>
<Global
styles={css`
${colorMode === 'light' ? prismLightTheme : prismDarkTheme};
html {
min-width: 356px;
scroll-behavior: smooth;
}
#__next {
display: flex;
flex-direction: column;
min-height: 100vh;
background: ${colorMode === 'light' ? 'white' : '#15161a'};
}
`}
/>
{children}
</>
)
}
Example #5
Source File: event.js From react-google-calendar with MIT License | 6 votes |
Event.propTypes = { name: PropTypes.string.isRequired, startTime: PropTypes.instanceOf(moment).isRequired, endTime: PropTypes.instanceOf(moment).isRequired, description: PropTypes.string, location: PropTypes.string, eventStyles: PropTypes.oneOfType([ PropTypes.object, PropTypes.instanceOf(css), ]), eventCircleStyles: PropTypes.oneOfType([ PropTypes.object, PropTypes.instanceOf(css), ]), eventTextStyles: PropTypes.oneOfType([ PropTypes.object, PropTypes.instanceOf(css), ]), tooltipStyles: PropTypes.oneOfType([ PropTypes.object, PropTypes.instanceOf(css), ]), calendarName: PropTypes.string, color: PropTypes.string }
Example #6
Source File: Affiliates.js From popper.js.org with MIT License | 6 votes |
MiniSponsor = styled((props) => (
<Tippy content={props.alt}>
<a
css={css`
display: block;
`}
href={props.href}
target="_blank"
className={props.className}
rel="noopener noreferrer"
>
<img src={props.src} alt={props.alt} width="40" height="40" />
</a>
</Tippy>
))`
opacity: 0.2;
transition: opacity 0.2s ease-in-out;
&:hover {
opacity: 1;
}
img {
height: 40px;
margin: 10px;
}
`
Example #7
Source File: AppLayout.js From react-spa-template with MIT License | 6 votes |
globalStyle = (colors) => css`
body {
color: ${colors.gray[9]};
background: ${colors.gray[1]};
transition-duration: 0.3s;
transition-timing-function: ease;
transition-property: border, background, color;
}
main {
flex: 1;
margin: 0 auto;
max-width: 1280px;
display: flex;
flex-direction: column;
}
`
Example #8
Source File: base-css.js From tonic-ui with MIT License | 6 votes |
baseCSS = theme => {
return css`
/**
* Apply a natural box layout model to all elements, but allowing components to change.
*/
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
html {
font-family: ${_get(theme, 'fonts.base')};
}
pre,
code,
kbd,
samp {
font-family: ${_get(theme, 'fonts.mono')};
}
`;
}
Example #9
Source File: theme-switcher.js From velocitypowered.com with MIT License | 5 votes |
iconCommonCss = css`
vertical-align: middle;
padding-top: 2px;
padding-left: 6px;
`
Example #10
Source File: _typographies.js From aava.sh with MIT License | 5 votes |
regularTextStyle = css`
font-family: RobotoMono;
font-size: 20px;
`
Example #11
Source File: prism.js From benjamincarlson.io with MIT License | 5 votes |
prismDarkTheme = css`
${prismBaseTheme};
:not(pre) > code[class*='language-'] {
background: #011627;
}
.token.attr-name {
color: rgb(173, 219, 103);
font-style: italic;
}
.token.comment {
color: rgb(128, 147, 147);
}
.token.string,
.token.url {
color: rgb(173, 219, 103);
}
.token.variable {
color: rgb(214, 222, 235);
}
.token.number {
color: rgb(247, 140, 108);
}
.token.builtin,
.token.char,
.token.constant,
.token.function {
color: rgb(130, 170, 255);
}
.token.punctuation {
color: rgb(199, 146, 234);
}
.token.selector,
.token.doctype {
color: rgb(199, 146, 234);
font-style: 'italic';
}
.token.class-name {
color: rgb(255, 203, 139);
}
.token.tag,
.token.operator,
.token.keyword {
color: #ffa7c4;
}
.token.boolean {
color: rgb(255, 88, 116);
}
.token.property {
color: rgb(128, 203, 196);
}
.token.namespace {
color: rgb(178, 204, 214);
}
code[class*='language-'],
pre[class*='language-'] {
color: ${theme.colors.gray[50]};
}
:not(pre) > code[class*='language-'],
pre[class*='language-'] {
background: ${theme.colors.gray[800]};
border: 1px solid ${theme.colors.gray[700]};
}
.mdx-marker {
background-color: ${theme.colors.gray[700]};
}
.remark-code-title {
background: ${theme.colors.gray[700]};
color: ${theme.colors.gray[100]};
border: 1px solid ${theme.colors.gray[700]};
}
`
Example #12
Source File: event.js From react-google-calendar with MIT License | 5 votes |
render() {
return (
<Manager>
<div
className="event"
tabIndex="0"
onBlur={this.closeTooltip}
css={css`
position: relative;
&:focus {
outline: none;
}
`}
>
<Reference>
{({ref}) => (
<div css={[css`
border-radius: 3px;
width: 100%;
&:hover {
cursor: pointer;
background: rgba(81, 86, 93, 0.1);
}
`, this.props.eventStyles]}
onClick={this.toggleTooltip}
ref={ref}
>
<div
className="event-text"
css={[{
color: "#51565d",
padding: "3px 0px 3px 20px",
marginRight: "5px",
overflowX: "hidden",
whiteSpace: "nowrap",
position: "relative",
textAlign: "left",
}, this.props.eventTextStyles]}
>
<span css={[{
position: "absolute",
top: "5px",
left: "2px",
color: this.props.color,
height: "15px",
width: "15px",
}, this.props.eventCircleStyles]}>
<FiberManualRecordIcon fill="currentColor" fontSize="inherit" width="100%" />
</span>
<span css={css`
@media (max-width: 599px) {
display: none;
}
`}>
{ this.state.startTime.format("h:mma ") }
</span>
<span css={{fontWeight: "500"}}>
{this.props.name}
</span>
</div>
</div>
)}
</Reference>
<Tooltip
name={this.props.name}
startTime={moment(this.props.startTime)}
endTime={moment(this.props.endTime)}
description={this.props.description}
location={this.props.location}
tooltipStyles={this.props.tooltipStyles}
showTooltip={this.state.showTooltip}
closeTooltip={this.closeTooltip}
calendarName={this.props.calendarName}
/>
</div>
</Manager>
)
}
Example #13
Source File: Demos.js From popper.js.org with MIT License | 5 votes |
ArrowDemo = () => {
const [hide, setHide] = useState(false);
const { reference, popper } = usePopper({
placement: 'right',
modifiers: [
{
name: 'applyArrowHide',
enabled: true,
phase: 'write',
fn({ state }) {
setHide(state.modifiersData.arrow.centerOffset !== 0);
},
},
{
name: 'preventOverflow',
options: {
tetherOffset: () => (hide ? -16 : 0),
},
},
],
});
return (
<>
<ClippingParent scrollable>
<Reference
ref={reference}
css={css`
position: absolute;
left: 15px;
`}
>
Reference
</Reference>
<Tooltip ref={popper}>
<div
css={css`
display: grid;
place-items: center;
height: 200px;
width: 100px;
`}
></div>
<Arrow
data-popper-arrow
css={css`
&::before {
transition: transform 0.2s ease-out, visibility 0.2s ease-out;
visibility: ${hide ? 'hidden' : 'visible'};
transform: translateX(${hide ? 10 : 0}px) rotate(45deg);
transform-origin: center;
}
`}
/>
</Tooltip>
</ClippingParent>
</>
);
}
Example #14
Source File: SyntaxEditor.js From SyntaxMeets with MIT License | 5 votes |
override = css`
display: block;
margin: 0 auto;
border-color: red;
`
Example #15
Source File: Footer.js From react-spa-template with MIT License | 5 votes |
iconStyle = (color) => css`
width: 2rem;
height: 2rem;
stroke: ${color};
`
Example #16
Source File: CSSBaseline.js From tonic-ui with MIT License | 5 votes |
globalStyles = theme => css([
normalizeCSS(theme),
baseCSS(theme),
])
Example #17
Source File: prism.js From benjamincarlson.io with MIT License | 4 votes |
prismBaseTheme = css`
code {
white-space: pre;
}
code[class*='language-'],
pre[class*='language-'] {
color: ${theme.colors.gray[800]};
background: none;
font-family: ${theme.fonts.mono};
font-size: ${theme.fontSizes[2]};
text-align: left;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: ${theme.lineHeights[2]};
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
width: 100%;
}
/* Code blocks */
pre[class*='language-'] {
padding-top: ${theme.space[4]};
padding-bottom: ${theme.space[4]};
padding-left: ${theme.space[4]};
padding-right: ${theme.space[4]};
margin: ${theme.space[6]} 0;
overflow: auto;
min-width: 100%;
font-size: 0.9rem;
white-space: nowrap;
}
:not(pre) > code[class*='language-'],
pre[class*='language-'] {
background: ${theme.colors.gray[50]};
border: 1px solid ${theme.colors.gray[200]};
border-radius: ${theme.radii.lg};
}
/* Inline code */
:not(pre) > code[class*='language-'] {
padding: 0.1em;
border-radius: 0.3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.token.namespace {
opacity: 0.7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #9a6e3a;
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function,
.token.class-name {
color: #dd4a68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
.mdx-marker {
display: block;
margin-left: -${theme.space[4]};
margin-right: -${theme.space[4]};
padding-left: ${theme.space[4]};
padding-right: ${theme.space[4]};
background-color: ${theme.colors.gray[200]};
box-shadow: inset 3px 0px 0 0px ${theme.colors.blue[600]};
min-width: fit-content;
}
.remark-code-title {
padding: ${theme.space[2]} ${theme.space[4]};
font-family: ${theme.fonts.mono};
background: ${theme.colors.gray[200]};
color: ${theme.colors.gray[800]};
border: 1px solid ${theme.colors.gray[200]};
border-top-left-radius: ${theme.radii.lg};
border-top-right-radius: ${theme.radii.lg};
font-size: 0.8rem;
font-weight: 600;
margin-bottom: 0;
width: 100%;
+ pre {
border-top-left-radius: 0;
border-top-right-radius: 0;
margin-top: 0 !important;
}
}
`
Example #18
Source File: multiEvent.js From react-google-calendar with MIT License | 4 votes |
render() {
const leftArrow = css`
margin-left: 8px;
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
&:before {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 0;
height: 0;
border-right: 8px solid ${this.state.color};
border-top: 13px solid transparent;
border-bottom: 13px solid transparent;
}
&:hover::before {
cursor: pointer;
border-right-color: ${this.state.darkColor};
}
`;
const rightArrow = css`
margin-right: 8px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
&:after {
content: "";
position: absolute;
right: 0;
bottom: 0;
width: 0;
height: 0;
border-left: 8px solid ${this.state.color};
border-top: 13px solid transparent;
border-bottom: 13px solid transparent;
}
&:hover::after {
cursor: pointer;
border-left-color: ${this.state.darkColor};
}
`;
return (
<div
className="event"
tabIndex="0"
onBlur={this.closeTooltip}
css={css`
width: ${'calc(' + this.props.length + '00% + ' + (this.props.length - 1) + 'px)'};
&:focus {
outline: none;
}
position: relative;
`}
>
<Manager>
<Reference>
{({ref}) => (
<div css={[css`
width: ${'calc(100% - ' + 8 * (this.props.arrowLeft + this.props.arrowRight) + 'px)'};
border-radius: 3px;
background: ${this.state.color};
&:hover {
background: ${this.state.darkColor};
}
${this.props.arrowLeft && leftArrow}
${this.props.arrowRight && rightArrow}
`, this.props.multiEventStyles]}
onClick={this.toggleTooltip}
ref={ref}
>
<div
className="event-text"
css={{
padding: '3px 0px',
color: 'white',
marginLeft: this.props.arrowLeft ? '2px' : '5px',
marginRight: this.props.arrowRight ? '0px' : '5px',
overflowX: 'hidden',
whiteSpace: 'nowrap',
position: 'relative',
textAlign: 'left',
'&:hover': {
cursor: 'pointer',
},
}}
>
{
this.state.allDay ? "" : this.state.startTime.format("h:mma ")
}
<span css={{fontWeight: "500"}}>
{this.props.name}
</span>
</div>
</div>
)}
</Reference>
<Tooltip
name={this.props.name}
startTime={moment(this.props.startTime)}
endTime={moment(this.props.endTime)}
description={this.props.description}
location={this.props.location}
tooltipStyles={this.props.tooltipStyles}
showTooltip={this.state.showTooltip}
closeTooltip={this.closeTooltip}
calendarName={this.props.calendarName}
/>
</Manager>
</div>
)
}
Example #19
Source File: Affiliates.js From popper.js.org with MIT License | 4 votes |
Sponsors = () => {
if (typeof window === 'undefined') {
return null;
}
return (
<>
<StaticQuery
query={graphql`
query getAllImages {
allImageSharp {
edges {
node {
id
fluid {
src
srcSet
srcWebp
srcSetWebp
base64
aspectRatio
originalImg
originalName
sizes
}
}
}
}
}
`}
render={(data) => {
if (
typeof window !== 'undefined' &&
window.innerWidth > 600 &&
bigOne
) {
const edge = data.allImageSharp.edges.find((edge) =>
bigOne.xlImage.includes(edge.node.fluid.originalName)
);
return (
<ProductCard
title={bigOne.title}
description={bigOne.description}
fluid={edge.node.fluid}
url={bigOne.url}
/>
);
} else {
return (
<Grid>
{random.map(({ title, description, image, url }) => {
const edge = data.allImageSharp.edges.find((edge) =>
image.includes(edge.node.fluid.originalName)
);
if (edge == null) return null;
return (
<ProductCard
title={title}
description={description}
fluid={edge.node.fluid}
url={url}
/>
);
})}
</Grid>
);
}
}}
/>
<div style={{ height: '2em' }} />
<div
css={css`
display: flex;
justify-content: center;
flex-wrap: wrap;
`}
>
{MINI_SPONSORS.map((sponsor) => (
<MiniSponsor
src={sponsor.logo}
alt={sponsor.label}
href={sponsor.url}
/>
))}
</div>
</>
);
}
Example #20
Source File: SyntaxEditor.js From SyntaxMeets with MIT License | 4 votes |
SyntaxEditor = (props) => {
const [theme, setTheme] = useState("monokai");
const [popup, setPopup] = useState([false, ""]);
const [filePopup, setFilePopup] = useState(false);
const [fileHandleError, setFileHandleError] = useState("");
const [fullscreen,setFullscreen] = useState(false); // maintain state of screen in syntax Editor
const [modalIsOpen,setModalIsOpen] = useState(false)
const [shareURL,setshareURL] = useState("")
const [isLoading,setIsLoading]=useState(false)
// This will resend a message to update the code of the newly joined user
useEffect(() => {
let UpdatedCode = props.code;
if (props.previousUser.id === props.id) {
props.socket.emit("message", UpdatedCode);
}
// if the user was connected then over reloading the page this block is called
else if(sessionStorage.getItem('isconnected'))
{
//it used to save the code in sessionStorage when only one user is using there in a room
props.setCode(sessionStorage.getItem('code'));
}
}, [props.previousUser]);
const classes = useStyles();
useEffect(() => {
props.socket.on("message", (newValue) => {
props.setCode(newValue);
});
}, []);
const handleChange = (newValue) => {
props.setCode(newValue);
sessionStorage.setItem('code',newValue);
props.socket.emit("message", newValue);
};
const copyCode = (value) => {
copy(value);
setPopup([true, "Code Copied Sucessfully"]);
};
const fetchSharedCodeLink=async (content) =>{
var response = await fetch("https://dpaste.com/api/v2/", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: "content=" + encodeURIComponent(content)
});
return response.text();
}
const shareCode = (value) => {
setModalIsOpen(true)
setIsLoading(true)
fetchSharedCodeLink(value).then(url => {setIsLoading(false);setshareURL(url) });
}
const handleCodeRun = () => {
props.executeCode(langId[props.currLang], props.code, props.codeInput);
};
const handleCodeDownload = () => {
// download code here...
const element = document.createElement("a");
const file = new Blob([props.code], {
type: "text/plain;charset=utf-8",
});
element.href = URL.createObjectURL(file);
element.download = `syntaxmeets-code.${getExtensionByLangCode(
props.currLang
)}`;
document.body.appendChild(element);
element.click();
};
const IONavbar = (props) => {
return (
<AppBar position="static" style={{ backgroundColor: "#000A29" }}>
<Typography
variant="h6"
style={{
fontFamily: "poppins",
color: "white",
marginRight: "auto",
marginTop: "auto",
marginBottom: "auto",
marginLeft: "auto",
fontWeight: "400",
padding: "3px 2px",
}}
>
{props.type}
</Typography>
</AppBar>
);
};
const uploadFile = () => {
document.querySelector("#upload").click();
};
const checkValidFileExtension = (file) => {
const validExtensions = Object.keys(langExtensionDict);
var name = file.name;
var valid = false;
if (name.length > 0) {
for (var i = 0; i < validExtensions.length; ++i) {
var ext = validExtensions[i];
if (
name.substr(name.length - ext.length, ext.length).toLowerCase() ==
ext.toLowerCase()
) {
valid = true;
break;
}
}
}
return valid;
};
const handleFileChange = () => {
var file = document.querySelector("#upload").files[0];
if (file) {
var reader = new FileReader();
reader.onload = function (e) {
if (file.size > 10000) {
setFilePopup(true);
setFileHandleError("Error: File size greater than 10KB!");
return;
}
if (!checkValidFileExtension(file)) {
setFilePopup(true);
setFileHandleError("Error: Not a Valid File Extension!");
return;
}
handleChange(e.target.result);
const fileNameArr = file.name.split(".");
const ext = `.${fileNameArr[fileNameArr.length - 1]}`;
props.setLanguage(langExtensionDict[ext]);
};
reader.onerror = function (e) {
console.error("An error ocurred reading the file", e);
};
reader.readAsText(file, "UTF-8");
}
};
// handle fullscreen mode
const handleFullscreen = (props) =>{
fullscreen ? setFullscreen(false) : setFullscreen(true);
props.toggleFocusMode();
}
return (
<Fragment>
<Dialog fullWidth={true} maxWidth={"sm"} open={props.isCompiling}>
<DialogTitle style={{ align: "center" }}>Compiling ...</DialogTitle>
<div className={localClasses.loader}>
<div>
<span style={{ paddingLeft: "190px" }}>
<ShareIcon style={{ fontSize: "125px" }} />
</span>
<span className={localClasses.arrow}>></span>
</div>
</div>
</Dialog>
<Dialog maxWidth={"sm"} open={props.isError}>
<DialogTitle>Oops Error Occured</DialogTitle>
<span style={{ marginLeft: "15px" }}>{props.codeError}</span>
<DialogActions>
<Button
onClick={() => props.setIsError(false)}
variant="contained"
size="large"
color="primary"
>
Close
</Button>
</DialogActions>
</Dialog>
<Snackbar
open={popup[0]}
autoHideDuration={2000}
onClose={() => {
setPopup([false, ""]);
}}
>
<Alert
onClose={() => {
setPopup([false, ""]);
}}
severity="success"
variant="filled"
>
{popup[1]}
</Alert>
</Snackbar>
<Snackbar
open={filePopup}
autoHideDuration={2000}
onClose={() => {
setFilePopup(false);
}}
>
<Alert
onClose={() => {
setFilePopup(false);
}}
severity="error"
variant="filled"
>
{fileHandleError}
</Alert>
</Snackbar>
<AppBar position="static" style={{ backgroundColor: "#000A29" }}>
<div className={`${localClasses.Editor__navbar} row`}>
<Typography
variant="h5"
style={{
fontFamily: "poppins",
color: "white",
marginRight: "auto",
marginTop: "auto",
marginBottom: "auto",
marginLeft: "30px",
fontWeight: "800",
}}
>
Syntax<span style={{ color: "#FFD500" }}>Editor</span>
</Typography>
<Toolbar>
<FormControl
size="small"
variant="outlined"
className={classes.formControl}
>
<InputLabel
id="mode-label"
style={{ fontFamily: "poppins", color: "#FFD500" }}
>
Language
</InputLabel>
<Select
name="mode"
labelId="mode-label"
id="select-mode"
value={props.currLang}
onChange={(e) => {
props.setLanguage(e.target.value);
}}
label="Language"
style={{ fontFamily: "poppins", color: "#ffffff" }}
>
{LangOptions.map((language) => (
<MenuItem value={language} key={language}>
<span className={localClasses.Menu__options}>
{language}
</span>
</MenuItem>
))}
</Select>
</FormControl>
<FormControl
size="small"
variant="outlined"
className={classes.formControl}
>
<InputLabel
id="theme-label"
style={{ fontFamily: "poppins", color: "#FFD500" }}
>
Theme
</InputLabel>
<Select
name="Theme"
labelId="theme-label"
id="select-theme"
onChange={(e) => setTheme(e.target.value)}
value={theme}
label="Theme"
style={{ fontFamily: "poppins", color: "#ffffff" }}
>
{themes.map((lang) => (
<MenuItem key={lang} value={lang}>
<span className={localClasses.Menu__options}> {lang} </span>
</MenuItem>
))}
</Select>
</FormControl>
<FormControl
size="small"
variant="outlined"
className={classes.formControl}
>
<InputLabel
id="font-label"
style={{ fontFamily: "poppins", color: "#FFD500" }}
>
Font Size
</InputLabel>
<Select
name="Theme"
labelId="font-label"
id="select-font"
onChange={(e) => props.setFontSize(e.target.value)}
value={props.fontSize}
label="Font Size"
style={{ fontFamily: "poppins", color: "#ffffff" }}
>
{[10, 12, 14, 16, 18, 20, 24, 28, 32, 40].map((size) => (
<MenuItem key={size} value={size}>
<span className={localClasses.Menu__options}> {size} </span>
</MenuItem>
))}
</Select>
</FormControl>
</Toolbar>
</div>
</AppBar>
<Dialog fullWidth={true} maxWidth={"xs"} open={modalIsOpen}>
<CloseIcon style={{fontSize: "2em", position: "absolute", right: "5px", top: "5px"}} onClick={()=>{
setModalIsOpen(false)
setshareURL("")
}}/>
<DialogTitle style={{ textAlign: "center", marginTop: "10px" }}>
Share Your Code
</DialogTitle>
<DialogContent>
<div style={{display: "flex", alignItems: "center", margin: "20px"}}>
{isLoading ?
<BeatLoader color='red' loading={true} css={override} size={50} /> :
<>
<Typography style={{ padding: "5px 10px", background: "#eee", borderRadius: "3px" }}>{shareURL}</Typography>
<Tooltip title="Copy Url" arrow TransitionComponent={Zoom}>
<Button
variant="contained"
color="primary"
onClick={() => {
copy(shareURL)
setPopup([true, "Url Copied !!!"])
}}
style={{
fontFamily: "poppins",
marginLeft: "auto",
fontWeight: "600",
color: "white",
}}
>
<FileCopyIcon />
</Button>
</Tooltip>
</>
}
</div>
</DialogContent>
</Dialog>
<AceEditor
mode={langMode[props.currLang]}
theme={theme}
height="550px"
width={"auto"}
value={props.code}
onChange={handleChange}
fontSize={props.fontSize}
showPrintMargin
showGutter
highlightActiveLine
name="CODEEDITOR"
setOptions={{
useWorker: false,
enableLiveAutocompletion: props.autoCompletion,
}}
/>
<AppBar
position="static"
style={{ backgroundColor: "#000A29", marginBottom: "10px" }}
>
<Toolbar>
<FormControlLabel
control={
<Switch
color="primary"
checked={props.autoCompletion}
onChange={() => {
props.setAutoCompletion(!props.autoCompletion);
}}
name="EnableAutoCompletion"
/>
}
label={
<Typography>
<span style={{ color: "white" }}>Auto-complete</span>
</Typography>
}
/>
<input
type="file"
id="upload"
onChange={() => handleFileChange()}
hidden
accept=".c, .cpp, .java, .js, .ts, .clj, .cljs, .cs, .cbl, .cob, .cpy, .erl, .hrl, .go, .py, .f90, .f95, .f03, .txt, .groovy, .gvy, .gy, .gsh, .kt, .kts, .ktm, .php, .r, .rb, .sql, .swift"
/>
<ButtonGroup
style={{ marginLeft: "auto" }}
variant="contained"
color="primary"
>
<Tooltip title="Upload Code" arrow TransitionComponent={Zoom}>
<Button
variant="contained"
color="primary"
onClick={() => uploadFile()}
style={{
fontFamily: "poppins",
marginLeft: "auto",
fontWeight: "600",
color: "white",
}}
>
<CloudUploadIcon />
</Button>
</Tooltip>
<Tooltip title="Share Code" arrow TransitionComponent={Zoom}>
<Button
variant="contained"
color="primary"
onClick={() => shareCode(props.code)}
style={{
fontFamily: "poppins",
marginLeft: "auto",
fontWeight: "600",
color: "white",
}}
>
<ShareIcon />
</Button>
</Tooltip>
<Tooltip title="Copy Code" arrow TransitionComponent={Zoom}>
<Button
variant="contained"
color="primary"
onClick={() => copyCode(props.code)}
style={{
fontFamily: "poppins",
marginLeft: "auto",
fontWeight: "600",
color: "white",
}}
>
<FileCopyIcon />
</Button>
</Tooltip>
<Tooltip title="Download Code" arrow TransitionComponent={Zoom}>
<Button
variant="contained"
color="primary"
style={{
fontFamily: "poppins",
marginLeft: "auto",
fontWeight: "600",
color: "white",
}}
onClick={handleCodeDownload}
>
<CloudDownloadRounded style={{ fontSize: 24 }} />
</Button>
</Tooltip>
<Tooltip title={fullscreen ? "Exit Full Screen" : "Full Screen"} arrow TransitionComponent={Zoom}>
<Button
variant="contained"
color="primary"
style={{
fontFamily: "poppins",
marginLeft: "auto",
fontWeight: "600",
color: "white",
}}
onClick={() => handleFullscreen(props)}
>
{fullscreen
?<FullscreenExitRounded style={{ fontSize: 24 }}/>
:<FullscreenRounded style={{ fontSize: 24 }}/>
}
</Button>
</Tooltip>
</ButtonGroup>
<Button
variant="contained"
color="primary"
onClick={handleCodeRun}
startIcon={<PlayArrowIcon style={{ fontSize: 24 }} />}
style={{
fontFamily: "poppins",
marginLeft: "10px",
fontWeight: "600",
color: "#fff",
backgroundColor: "#FFD500",
}}
>
Run
</Button>
</Toolbar>
</AppBar>
<Grid container spacing={0}>
<Grid item xs={12} sm={12} md={6}>
<IONavbar type={"Input"} />
<INPUT />
</Grid>
<Grid item xs={12} sm={12} md={6}>
<IONavbar type={"Output"} />
<OUTPUT />
</Grid>
</Grid>
</Fragment>
);
}
Example #21
Source File: normalize-css.js From tonic-ui with MIT License | 4 votes |
normalizeCSS = theme => css`
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the \`main\` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on \`h1\` elements within \`section\` and
* \`article\` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd \`em\` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd \`em\` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent \`sub\` and \`sup\` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from \`fieldset\` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* \`fieldset\` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to \`inherit\` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}
`