Difference between revisions of "Template:Ribbon2"

From Geohashing
(Split themes into their own templates?)
(Probably missing a bunch or variables in the sub-template call)
Line 1: Line 1:
 
<!-- this css MUST NOT have any variables in it - someday, it'll be moved to [[MediaWiki:Common.css]] -->
 
<!-- this css MUST NOT have any variables in it - someday, it'll be moved to [[MediaWiki:Common.css]] -->
 
{{#css:
 
{{#css:
.xkcd-ribbon2-wrapper {
+
.ribbon2-wrapper {
 
   display:flex;
 
   display:flex;
 
}
 
}
.xkcd-ribbon2 {
+
.ribbon2 {
  display: inline-grid;
 
 
   padding: 5px 5px 5px 0;
 
   padding: 5px 5px 5px 0;
 
   margin: 2px 0;
 
   margin: 2px 0;
Line 11: Line 10:
 
   border: 1px solid lightgray;
 
   border: 1px solid lightgray;
 
   border-left: 5px solid #bada55;
 
   border-left: 5px solid #bada55;
   background-color: blue;
+
   align-items: center;
 +
}
 +
 
 +
.ribbon2-grid {
 +
  display: grid;
 
   grid-template-areas:  
 
   grid-template-areas:  
 
       "icon achv imag xtra"
 
       "icon achv imag xtra"
 
       "icon actn imag xtra";
 
       "icon actn imag xtra";
 
   grid-template-columns: min-content auto min-content min-content;
 
   grid-template-columns: min-content auto min-content min-content;
  align-items: center;
 
 
}
 
}
.xkcd-ribbon2 > * {
+
 
 +
.ribbon2-flex {
 +
  display:flex;
 +
}
 +
 
 +
.ribbon2-flex .ribbon2-actn {
 +
  max-height: 4em;
 +
  overflow-y: scroll;
 +
}
 +
 
 +
.ribbon2 > * {
 
   margin: 0 5px;
 
   margin: 0 5px;
 
}
 
}
.xkcd-ribbon2-icon {
+
.ribbon2-icon {
 
   grid-area: icon;
 
   grid-area: icon;
 
}
 
}
.xkcd-ribbon2-achv {
+
.ribbon2-achv {
 
   grid-area: achv;
 
   grid-area: achv;
 
   font-weight: bold;
 
   font-weight: bold;
 
}
 
}
.xkcd-ribbon2-actn {
+
.ribbon2-grid .ribbon2-actn {
 
   grid-area: actn;
 
   grid-area: actn;
 
   padding-left: 1em;
 
   padding-left: 1em;
 
}
 
}
.xkcd-ribbon2-xtra {
+
.ribbon2-xtra {
 
   grid-area: xtra;
 
   grid-area: xtra;
 
}
 
}
.xkcd-ribbon2-imag {
+
.ribbon2-imag {
 
   grid-area: imag;
 
   grid-area: imag;
 
}
 
}
  
.xkcd-ribbon2-icon a { display: flex; }
+
.ribbon2-icon a { display: flex; }
.xkcd-ribbon2-theme-default .xkcd-ribbon2-icon {width: 70px;}
+
.ribbon2-theme-default .ribbon2-icon {width: 70px;}
  
.xkcd-ribbon2-xtra, .xkcd-ribbon2-imag {
+
.ribbon2-xtra, .ribbon2-imag {
 
   padding-left: 10px;
 
   padding-left: 10px;
 
   border-left: 1px solid lightgray;
 
   border-left: 1px solid lightgray;
Line 52: Line 64:
  
  
.xkcd-ribbon2-theme-mini {
+
.ribbon2-theme-mini {
 
   grid-template-areas: "icon achv actn . imag xtra";
 
   grid-template-areas: "icon achv actn . imag xtra";
 
   grid-template-columns: min-content max-content max-content auto min-content min-content;
 
   grid-template-columns: min-content max-content max-content auto min-content min-content;
 
   padding: 0;
 
   padding: 0;
 
}
 
}
.xkcd-ribbon2-theme-mini .xkcd-ribbon2-actn {
+
.ribbon2-theme-mini .ribbon2-actn {
 
   padding-left: 0;
 
   padding-left: 0;
 
}
 
}
.xkcd-ribbon2-theme-mini .xkcd-ribbon2-achv::after {
+
.ribbon2-theme-mini .ribbon2-achv::after {
 
   /* for some reason `content: " ";` doesn't work */
 
   /* for some reason `content: " ";` doesn't work */
 
   content: "&nbsp;";
 
   content: "&nbsp;";
 
}
 
}
.xkcd-ribbon2-theme-mini img {
+
.ribbon2-theme-mini img {
 
   width: 22px;
 
   width: 22px;
 
   height: 22px;
 
   height: 22px;
 
}
 
}
  
}}<div class="xkcd-ribbon2-wrapper">
+
}}{{Ribbon2/{{#switch:{{#var:ribbontheme}}|mini=mini|micro=micro|#default=default}}
  <div class="xkcd-ribbon2 xkcd-ribbon2-theme-{{#var:ribbontheme|default}}" style="border-left-color: {{{color|#bada55}}}; background-color: {{{background|transparent}}}; width:{{{width|{{#var:ribbonwidth|auto}}}}}; color:{{{fontcolor|black}}}">
+
|color={{{color|#bada55}}}
    <div class="xkcd-ribbon2-icon">{{{iconcode|[[File:{{{icon|Landgeohash.png}}}|70px]]}}}</div>
+
|icon={{{icon|landgeohash.png}}}
    <div class="xkcd-ribbon2-achv">{{{achievement}}}</div>
+
|achievement={{{achievement}}}
    <div class="xkcd-ribbon2-actn">{{{action}}}</div>
+
|action={{{action}}}
    {{#if:{{{image|}}}|<div class="xkcd-ribbon2-imag">[[File:{{{image}}}|44px]]</div>|}}
+
|expedition={{{expedition}}}
    {{#if:{{{extra|}}}|<div class="xkcd-ribbon2-xtra">{{{extra}}}</div>|}}
+
}}<noinclude>
  </div>
 
</div><noinclude>
 
  
 
== Tests ==
 
== Tests ==
 
{{Ribbon2|action={{Lipsum}}|image=2020-02-08_43_-79_SIGSTKFLT-stupidgrin.jpg}}
 
{{Ribbon2|action={{Lipsum}}|image=2020-02-08_43_-79_SIGSTKFLT-stupidgrin.jpg}}
{{Frozen Geohash|latitude=43|longitude=-79|date=2020-02-08|temperature=-17°C|name=SIGSTKFLT|multiplier=3|image=2020-02-08_43_-79_SIGSTKFLT-stupidgrin.jpg}}
+
<!--{{Frozen Geohash|latitude=43|longitude=-79|date=2020-02-08|temperature=-17°C|name=SIGSTKFLT|multiplier=3|image=2020-02-08_43_-79_SIGSTKFLT-stupidgrin.jpg}}-->
 
{{#vardefine:ribbonwidth|100%}}
 
{{#vardefine:ribbonwidth|100%}}
 
{{Ribbon2}}
 
{{Ribbon2}}
 
{{#vardefine:ribbontheme|mini}}
 
{{#vardefine:ribbontheme|mini}}
{{Ribbon2|action={{Lipsum}}}}
+
{{Ribbon2/test|action={{Lipsum}}}}
 +
{{#vardefine:ribbontheme|micro}}
 +
{{Ribbon2/test|achievement=foo|expedition=bar}}
  
 
== TODO ==
 
== TODO ==
  
* Handle long actions in mini and micro themes
+
* <s>Handle long actions in mini and micro themes</s>
* Split themes into their own templates?
+
* <s>Split themes into their own templates?</s>
  
  
 
</noinclude>
 
</noinclude>

Revision as of 14:31, 25 September 2020

Landgeohash.png
{{{achievement}}}
{{{action}}}

Tests

Landgeohash.png
{{{achievement}}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
2020-02-08 43 -79 SIGSTKFLT-stupidgrin.jpg


Landgeohash.png
{{{achievement}}}
{{{action}}}


Landgeohash.png
{{{achievement}}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


Landgeohash.png
foo:
bar

TODO

  • Handle long actions in mini and micro themes
  • Split themes into their own templates?