1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Using css-in-js styling in support-page extension

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2020-11-11 14:39:36 +03:00
parent 0d43cd9861
commit 74596b086e
6 changed files with 49 additions and 41 deletions

View File

@ -9,13 +9,15 @@
"dev": "webpack --watch",
"test": "echo NO TESTS"
},
"dependencies": {},
"devDependencies": {
"@emotion/core": "^10.1.1",
"@emotion/styled": "^10.0.27",
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
"@types/react": "^16.9.53",
"@types/react-router": "^5.1.8",
"@types/webpack": "^4.41.17",
"css-loader": "^5.0.0",
"emotion": "^10.0.27",
"mobx": "^5.15.5",
"react": "^16.13.1",
"sass-loader": "^10.0.4",

View File

@ -2,6 +2,14 @@ import React from "react";
import { Component, LensRendererExtension, Navigation } from "@k8slens/extensions";
import { supportPageRoute, supportPageURL } from "./src/support.route";
import { Support } from "./src/support";
import styled from '@emotion/styled';
const Icon = styled.div`
color: white;
display: flex;
align-items: center;
padding-right: calc(var(--padding) / 2);
`
export default class SupportPageRendererExtension extends LensRendererExtension {
globalPages = [
@ -18,12 +26,14 @@ export default class SupportPageRendererExtension extends LensRendererExtension
statusBarItems = [
{
item: (
<div
className="flex align-center gaps hover-highlight"
onClick={() => Navigation.navigate(supportPageURL())}
>
<Component.Icon material="help" smallest />
</div>
<Icon>
<Component.Icon
className="SupportIcon"
material="help"
smallest
onClick={() => Navigation.navigate(supportPageURL())}
/>
</Icon>
)
}
]

View File

@ -1,13 +0,0 @@
.PageLayout.Support {
a[target=_blank] {
text-decoration: none;
border-bottom: 1px solid;
&:after {
content: "launch";
font: small "Material Icons";
vertical-align: middle;
margin-left: 2px;
}
}
}

View File

@ -1,9 +1,22 @@
// TODO: support localization / figure out how to extract / consume i18n strings
import "./support.scss"
import React from "react"
import { observer } from "mobx-react"
import { App, Component } from "@k8slens/extensions";
import styled from '@emotion/styled';
const SupportPage = styled.div`
a[target=_blank] {
text-decoration: none;
&:after {
content: "launch";
font: small "Material Icons";
vertical-align: middle;
margin-left: 2px;
}
}
`
@observer
export class Support extends React.Component {
@ -11,19 +24,21 @@ export class Support extends React.Component {
const { PageLayout } = Component;
const { slackUrl, issuesTrackerUrl } = App;
return (
<PageLayout showOnTop className="Support" header={<h2>Support</h2>}>
<h2>Community Slack Channel</h2>
<p>
Ask a question, see what's being discussed, join the conversation <a href={slackUrl} target="_blank">here</a>
</p>
<SupportPage>
<PageLayout showOnTop header={<h2>Support</h2>}>
<h2>Community Slack Channel</h2>
<p>
Ask a question, see what's being discussed, join the conversation <a href={slackUrl} target="_blank">here</a>
</p>
<h2>Report an Issue</h2>
<p>
Review existing issues or open a new one <a href={issuesTrackerUrl} target="_blank">here</a>
</p>
<h2>Report an Issue</h2>
<p>
Review existing issues or open a new one <a href={issuesTrackerUrl} target="_blank">here</a>
</p>
{/*<h2><Trans>Commercial Support</Trans></h2>*/}
</PageLayout>
{/*<h2><Trans>Commercial Support</Trans></h2>*/}
</PageLayout>
</SupportPage>
);
}
}

View File

@ -2,14 +2,13 @@
$spacing: $padding / 2;
--flex-gap: #{$spacing};
font-size: $font-size-small;
background-color: #3d90ce;
padding: 0 2px;
color: white;
height: 22px;
#current-workspace {
font-size: var(--font-size-small);
padding: $padding / 4 $padding / 2;
color: white;
cursor: pointer;
}
@ -19,10 +18,4 @@
cursor: pointer;
}
}
.extensions {
> * {
padding: $padding / 4 $padding / 2;
}
}
}

View File

@ -17,6 +17,7 @@
.BottomBar {
grid-area: bottom-bar;
background-color: var(--blue);
}
#lens-views {