Skip to content

Commit

Permalink
Polish forms components and split out CSS files (#6259)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Jacomb <[email protected]>
  • Loading branch information
janfaracik and timja authored Feb 10, 2022
1 parent fb6f28b commit b97012a
Show file tree
Hide file tree
Showing 21 changed files with 881 additions and 845 deletions.
12 changes: 1 addition & 11 deletions core/src/main/resources/hudson/cli/CLIAction/example.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ THE SOFTWARE.

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<st:once>
<style type="text/css">
pre {
color: white;
background-color: black;
padding: 1em;
font-weight: bold;
}
</style>
</st:once>
<pre id="example">java -jar <a href="${rootURL}/jnlpJars/jenkins-cli.jar" style="color: white">jenkins-cli.jar</a> -s ${h.inferHudsonURL(request)} <j:if test="${it.webSocketSupported}">-webSocket</j:if> ${commandArgs}</pre>
<pre id="example">java -jar <a href="${rootURL}/jnlpJars/jenkins-cli.jar">jenkins-cli.jar</a> -s ${h.inferHudsonURL(request)} <j:if test="${it.webSocketSupported}">-webSocket</j:if> ${commandArgs}</pre>
</j:jelly>

2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/cli/CLIAction/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ THE SOFTWARE.
</h1>
</div>
</div>
<p>
<p class="jenkins-description">
${%blurb(rootURL)}
</p>
<j:set var="commandArgs" value="help"/>
Expand Down
6 changes: 4 additions & 2 deletions core/src/main/resources/lib/hudson/logRecords.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ THE SOFTWARE.
</st:attribute>
</st:documentation>
<j:set var="prior" value="${null}"/>
<j:forEach var="logRecord" items="${h.reverse(logRecords)}">
<div class="logrecord-container">
<j:forEach var="logRecord" items="${h.reverse(logRecords)}">
<j:set var="parts" value="${h.printLogRecordHtml(logRecord, prior)}"/>
<pre class="logrecord-metadata"><j:out value="${parts[0]}"/><st:nbsp/><j:out value="${parts[2]}"/><st:nbsp/><j:out value="${parts[1]}"/></pre>
<pre><j:out value="${parts[3]}"/></pre>
<j:set var="prior" value="${logRecord}"/>
</j:forEach>
</j:forEach>
</div>
</j:jelly>
9 changes: 0 additions & 9 deletions war/src/main/js/widgets/config/tabbar.less
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,6 @@
span.highlight {
background-color: #ffff00;
}

// CodeMirror
.CodeMirror {
background: var(--brightest-bg-color);
}

.CodeMirror-scroll {
border: 1px solid var(--input-border) !important;
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions war/src/main/less/abstracts/theme.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
:root {
// Font related properties
--font-family-sans: -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Noto Sans", oxygen, ubuntu, cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
--font-family-mono: ui-monospace, SFMono-Regular, SF Mono, JetBrainsMono, Consolas, monospace;
--font-size-base: 1rem; // 16px
--font-size-sm: 0.875rem; // 14px
--font-size-xs: 0.75rem; // 12px
Expand Down Expand Up @@ -280,9 +281,13 @@
--form-input-border-radius: 6px;
--form-input-glow: 0 0 0 10px transparent;
--form-input-glow--focus: 0 0 0 5px var(--focus-input-glow);
--pre-background: rgba(0, 0, 0, 0.05);
--pre-color: var(--text-color);
--selection-color: rgba(2, 76, 182, 0.3);

// Animations
--standard-transition: 0.2s ease;
--elastic-transition: 0.3s cubic-bezier(0, 0.68, 0.5, 1.5);

// Pop out menus
--menu-text-color: black;
Expand Down
12 changes: 10 additions & 2 deletions war/src/main/less/base-styles-v2.less
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,20 @@ html {
@import './base/visibility-utils';
@import './base/yui-compatibility';

@import './form/checkbox';
@import './form/codemirror';
@import './form/input';
@import './form/layout';
@import './form/radio';
@import './form/reorderable-list';
@import './form/search';
@import './form/select';
@import './form/toggle-switch';

@import './modules/app-bar';
@import './modules/badges';
@import './modules/buttons';
@import './modules/content-blocks';
@import './modules/draggable-card';
@import './modules/form';
@import './modules/icon-size';
@import './modules/icons';
@import './modules/manage-jenkins';
Expand Down
47 changes: 40 additions & 7 deletions war/src/main/less/base/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ dt {
font-weight: bold;
}

::selection {
background: var(--selection-color);
}

.fixed-width {
font-family: monospace;
}
Expand Down Expand Up @@ -219,13 +223,21 @@ td.tab {
}

pre {
white-space: pre-wrap; /* css-3 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
margin: 0;
}

pre a {
white-space: pre-wrap;
word-wrap: break-word;
margin: 0 0 var(--section-padding);
padding: 0.8rem 1rem;
border-radius: 10px;
background-color: var(--pre-background);
color: var(--pre-color) !important;
font-family: var(--font-family-mono) !important;
font-weight: 600 !important;
line-height: 1.66 !important;

a {
font-weight: inherit;
word-wrap: break-word;
}
}

pre.console {
Expand Down Expand Up @@ -718,6 +730,7 @@ table.parameters > tbody:hover {
table {
border-radius: 0;
min-width: 450px;
margin-bottom: 0;
box-sizing: content-box;
padding-bottom: 2px;

Expand Down Expand Up @@ -1063,7 +1076,7 @@ table.fingerprint-in-build td {
position: relative;
padding-left: 32px;
transition: var(--standard-transition);
margin-top: 0.66rem;
margin-top: calc(var(--section-padding) / 3);

&::after {
content: "";
Expand Down Expand Up @@ -1320,6 +1333,26 @@ table.progress-bar.red td.progress-bar-done {

/* ========================= logRecords.jelly ================== */

.logrecord-container {
border-radius: 10px;
overflow: hidden;

pre {
padding-top: 0;
padding-bottom: 0.1rem;
margin-bottom: 0;
border-radius: 0;

&:first-of-type {
padding-top: 0.8rem;
}

&:last-of-type {
padding-bottom: 0.8rem;
}
}
}

.logrecord-metadata {
font-size: var(--font-size-xs);
}
Expand Down
18 changes: 9 additions & 9 deletions war/src/main/less/base/typography.less
Original file line number Diff line number Diff line change
Expand Up @@ -51,45 +51,45 @@ h6,
line-height: var(--line-height-heading);
font-weight: bold;
display: block;
margin-top: 0.5rem;
margin-bottom: 0.5rem;
margin-top: 0;
margin-bottom: var(--section-padding);
}

h1,
.h1 {
font-size: 2rem;
font-size: 1.6rem;
}

h2,
.h2 {
font-size: 1.75rem;
font-size: 1.4rem;
}

h3,
.h3 {
font-size: 1.5rem;
font-size: 1.2rem;
}

h4,
.h4 {
font-size: 1.25rem;
font-size: 1rem;
}

h5,
.h5 {
font-size: 1rem;
font-size: 0.8rem;
}

h6,
.h6 {
font-size: 0.875rem;
font-size: 0.6rem;
}

.jenkins-description {
color: var(--text-color-secondary);
line-height: 1.66;
margin-top: 0;
margin-bottom: 2rem;
margin-bottom: var(--section-padding);
}

.jenkins-label {
Expand Down
143 changes: 143 additions & 0 deletions war/src/main/less/form/checkbox.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
.jenkins-checkbox-help-wrapper {
display: flex;
align-items: center;
justify-content: flex-start;
}

.jenkins-checkbox + a.jenkins-help-button {
vertical-align: top;
}

.jenkins-checkbox {
position: relative;
display: inline-flex;
}

.jenkins-checkbox input {
position: absolute;

width: 1px;
height: 1px;

// If margin is set to a negative value it can cause text to be announced in
// the wrong order in VoiceOver for OSX
margin: 0;
padding: 0;

overflow: hidden;
clip: rect(0 0 0 0);
clip-path: inset(50%);

&:checked {
& + label {
&:active,
&:focus {
&::before {
box-shadow: 0 0 0 5px var(--focus-input-glow), inset 0 0 0 12px var(--focus-input-border);
}
}
}

& + label {
&::before {
box-shadow: 0 0 0 10px transparent, inset 0 0 0 12px var(--focus-input-border);
}

&::after {
transform: scale(1);
}
}
}

&:disabled {
& + label {
cursor: not-allowed;

&::before {
opacity: 0.35 !important;
box-shadow: 0 0 0 10px transparent, inset 0 0 0 2px var(--input-border) !important;
}
}

&:checked {
& + label {
&::before {
box-shadow: 0 0 0 10px transparent, inset 0 0 0 12px var(--focus-input-border) !important;
}

&::after {
transform: scale(1) !important;
}
}
}
}
}

.jenkins-checkbox label {
position: relative;
display: inline-flex;
align-items: flex-start;
justify-content: flex-start;
margin: 0;
cursor: pointer;
line-height: 22px;
font-weight: var(--form-label-font-weight);

&::before {
content: "";
display: inline-block;
position: relative;
min-width: 22px;
min-height: 22px;
border-radius: 6px;
transition: var(--standard-transition);
margin-right: 11px;
box-shadow: 0 0 0 10px transparent, inset 0 0 0 2px var(--input-border);
}

&::after {
content: "";
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
left: 0;
width: 22px;
height: 22px;
background: var(--background);
mask-image: url("data:image/svg+xml;charset=UTF-8,%3c?xml version='1.0' encoding='UTF-8'?%3e%3csvg width='384px' height='320px' viewBox='0 0 384 320' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3ePath%3c/title%3e%3cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3e%3cpath d='M327.917546,10.9278525 C339.555371,-2.37251966 359.771775,-3.72027991 373.072147,7.91754577 C386.239516,19.4389932 387.692129,39.368305 376.427694,52.671077 L376.082454,53.0721475 L152.082454,309.072147 C140.014868,322.863675 118.889432,323.700972 105.767743,311.015951 L105.372583,310.627417 L9.372583,214.627417 C-3.12419433,202.13064 -3.12419433,181.86936 9.372583,169.372583 C21.7443926,157.000773 41.7261905,156.877055 54.2501999,169.001429 L54.627417,169.372583 L126.441,241.186 L327.917546,10.9278525 Z' id='Path' fill='%23FF0000' fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e");
mask-size: 10px 10px;
mask-repeat: no-repeat;
mask-position: center;
transition: var(--elastic-transition);
transform: scale(0);
}

&:empty {
&::before {
margin-right: 0;
}
}

&:hover {
&::before {
box-shadow: 0 0 0 10px transparent, inset 0 0 0 5px var(--input-border-hover);
}
}

&:active,
&:focus {
&::before {
box-shadow: 0 0 0 5px var(--focus-input-glow), inset 0 0 0 5px var(--focus-input-border);
}
}
}

.jenkins-checkbox__description {
margin-top: 0.3rem;
margin-left: 34px;
margin-bottom: 1rem;
color: var(--text-color-secondary);
line-height: 1.66;
}
Loading

0 comments on commit b97012a

Please sign in to comment.