Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webview design cleanup #170

Merged
merged 9 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions webview/src/components/Experiments/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ export const ExperimentsTable: React.FC<{
}> = ({ experiments: rawExperiments }) => {
const [initialState, defaultColumn] = React.useMemo(() => {
const initialState = {}
const defaultColumn: Partial<Column<Experiment>> = {}
const defaultColumn: Partial<Column<Experiment>> = {
width: 110
}
return [initialState, defaultColumn]
}, [])

Expand All @@ -83,7 +85,7 @@ export const ExperimentsTable: React.FC<{
if (id === 'workspace') return id
return id.slice(0, 7)
},
width: 200
width: 150
},
{
Header: 'Timestamp',
Expand Down Expand Up @@ -148,8 +150,8 @@ export const ExperimentsTable: React.FC<{
return (
<>
<div className={styles.tableOptions}>
<SortIndicator instance={instance} />
<ManageColumns instance={instance} />
<SortIndicator instance={instance} />
</div>
<Table instance={instance} />
</>
Expand All @@ -163,6 +165,7 @@ const Experiments: React.FC<{
return (
<div className={styles.experiments}>
<button
className={styles.experimentsButton}
onClick={() => {
vsCodeApi.postMessage({
type: MessageFromWebviewType.onClickRunExperiment
Expand Down
100 changes: 0 additions & 100 deletions webview/src/components/Menu/module.scss

This file was deleted.

7 changes: 2 additions & 5 deletions webview/src/components/Menu/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
display: inline-block;
max-width: 100%;
&__toggle {
padding-top: 0.375rem;
padding-right: 0.5rem;
padding-bottom: 0.375rem;
padding-left: 0.5rem;
padding: 0.375rem 0.5rem;
position: relative;
display: flex;
align-items: center;
Expand All @@ -15,7 +12,7 @@
max-width: 100%;
line-height: 1.5;
color: #ffffff;
background-color: #4f5255;
background-color: inherit;
border: none;
&__text {
overflow: hidden;
Expand Down
3 changes: 2 additions & 1 deletion webview/src/components/SortIndicator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const SortIndicator: React.FC<InstanceProp> = ({ instance }) => {

return (
<div className={styles.sortIndicator}>
<span className={styles.sortIndicator__text}>Sorted By</span>
<span className={styles.sortIndicator__text}>Sorted By: &nbsp; </span>
{''}
<span className={styles.sortIndicator__subText}>
{sortedByColumn ? (
<>
Expand Down
12 changes: 6 additions & 6 deletions webview/src/components/SortIndicator/styles.module.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.sortIndicator {
display: flex;
flex-direction: column;
align-items: baseline;

background-color: rgb(54, 54, 54);
min-width: 110px;
padding: 0.375rem 0.5rem;
background-color: #4f5255;
min-width: 150px;
color: #fafafa;
margin: 1rem 0;

&__text {
font-size: 14px;
font-size: 16px;
}
&__subText {
font-size: 15px;
font-size: 16px;
}
}
4 changes: 2 additions & 2 deletions webview/src/components/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ export const TableHead: React.FC<InstanceProp> = ({

return (
<div className={styles.thead}>
{headerGroups.slice(0, lastHeaderGroupIndex).map((headerGroup, i) => (
{/* {headerGroups.slice(0, lastHeaderGroupIndex).map((headerGroup, i) => (
<ParentHeaderGroup
headerGroup={headerGroup}
key={`header-group-${i}`}
/>
))}
))} */}
<PrimaryHeaderGroup headerGroup={lastHeaderGroup} />
</div>
)
Expand Down
58 changes: 50 additions & 8 deletions webview/src/components/Table/styles.module.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Variables

$row-bg-color: var(--vscode-editor-background);
$row-bg-alt-color: rgb(60, 60, 60, 1);
$row-bg-alt-color: rgba(60, 60, 60, 0.7);

// Extendable Silent Rules

Expand Down Expand Up @@ -95,6 +95,20 @@ $row-bg-alt-color: rgb(60, 60, 60, 1);
height: 100%;
display: flex;
flex-flow: column nowrap;
.experimentsButton {
width: fit-content;
background-color: #4f4f4f;
align-self: flex-start;
display: inline-block;
cursor: pointer;
color: #e8e8e8;
font-size: 0.9rem;
font-weight: bold;
padding: 0.3rem 0.7rem;
margin: 0.5rem 1rem;
text-decoration: none;
outline: none;
}
.firstCell {
display: flex;
flex-flow: row nowrap;
Expand Down Expand Up @@ -163,6 +177,7 @@ $row-bg-alt-color: rgb(60, 60, 60, 1);
}

.rowGroup {
font-family: 'monospace';
margin: 0.5rem 0;
}
.normalRowGroup {
Expand All @@ -186,13 +201,13 @@ $row-bg-alt-color: rgb(60, 60, 60, 1);
}
.td {
padding: 0 0.25rem;
font-size: 1.1rem;
font-size: 0.9rem;
line-height: 2rem;
align-items: center;
}
.experimentCell {
text-align: left;
padding-left: 1rem;
padding-left: 0.7rem;
}
.groupedCell,
.groupedHeader {
Expand All @@ -205,30 +220,57 @@ $row-bg-alt-color: rgb(60, 60, 60, 1);
.parentHeaderCell {
text-align: left;
padding: 0.1rem 0.2rem;
font-size: 0.9rem;
font-size: 0.8rem;
}
.headersRow {
text-align: center;
font-weight: bold;
font-size: 1.2rem;
font-size: 0.9rem;
user-select: none;
background-color: inherit;
border-bottom: 1px solid white;
.th {
border-bottom: 2px solid rgba(255, 255, 255, 0.5);
padding: 0.4rem 0.25rem;
}
.sortedHeader {
border-bottom: 2px solid rgba(255, 255, 255);
}
}
}
.webviewHeader {
display: flex;
justify-content: space-between;
align-items: center;
}

.experimentsButton:hover {
background-color: #414141;
}
.experimentsButton:active {
position: relative;
top: 1px;
}

.pageHeading {
font-size: 2rem;
font-size: 1.6rem;
margin: 1rem;
}

.optionsPanel {
margin: 0.5rem 1rem;
summary {
outline: none;
}
}

.tableOptions {
display: flex;
align-items: flex-start;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 100%;
padding: 0 1rem;
button {
background-color: rgb(54, 54, 54);
}
}
Binary file added webview/src/fonts/Roboto-Light.ttf
Binary file not shown.
Binary file added webview/src/fonts/RobotoMono-Light.ttf
Binary file not shown.
5 changes: 3 additions & 2 deletions webview/src/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
* {
box-sizing: border-box;
outline: none;
font-family: 'monospace', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably want to use some of the VSCode-injected CSS variables like --vscode-font-family, --vscode-font-weight, and --vscode-editor-font-family so we use the user's configured fonts- doing so allows us to integrate our webviews with the user's VSCode and take advantage of the fonts provided to us as a free resource.

I'm thinking since the --vscode-font-family is generally sans serif and --vscode-editor-font-family monospace, we can use the former for UI elements and the latter for the table.
This concern relates to #175 as well.

}

html,
Expand All @@ -11,10 +12,10 @@ body,

.react-root {
display: inline-block;
max-width: fit-content;
width: inherit;
}

body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0px;
padding: 0px;
border: 0px;
Expand Down
2 changes: 1 addition & 1 deletion webview/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = {
]
},
{
test: /\.(jpe?g|png|gif|eot|ttf|svg|woff|woff2|md)$/i,
test: /\.(jpe?g|png|gif|eot|svg|woff|woff2|md)$/i,
loader: 'file-loader'
},
{
Expand Down