Difference between revisions of "Template:Ribbon2"

From Geohashing
(Support for mini theme)
(reduce indent to 1em)
 
(25 intermediate revisions by 2 users not shown)
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;
+
  /* it's probably possible to remove this but idk how */
 +
   display: flex;
 
}
 
}
.xkcd-ribbon2 {
+
 
  display: inline-grid;
+
.ribbon2 {
   padding: 5px 5px 5px 0;
+
   padding: 5px;
 
   margin: 2px 0;
 
   margin: 2px 0;
  max-width: 100%;
 
 
   border: 1px solid lightgray;
 
   border: 1px solid lightgray;
   border-left: 5px solid #bada55;
+
   border-left: 5px solid;
   background-color: blue;
+
   border-radius: 1px;
  grid-template-areas:
 
      "icon achv . imag xtra"
 
      "icon actn . imag xtra";
 
  grid-template-columns: min-content min-content auto min-content min-content;
 
 
   align-items: center;
 
   align-items: center;
 
}
 
}
.xkcd-ribbon2 > * {
 
  margin: 0 5px;
 
}
 
.xkcd-ribbon2-icon {
 
  grid-area: icon;
 
}
 
.xkcd-ribbon2-achv {
 
  grid-area: achv;
 
  font-weight: bold;
 
}
 
.xkcd-ribbon2-actn {
 
  grid-area: actn;
 
  padding-left: 1em;
 
}
 
.xkcd-ribbon2-xtra {
 
  grid-area: xtra;
 
}
 
.xkcd-ribbon2-imag {
 
  grid-area: imag;
 
}
 
  
.xkcd-ribbon2-icon a { display: flex; }
+
.ribbon2[data-ribbon2-theme=default] {
.xkcd-ribbon2-theme-default .xkcd-ribbon2-icon {width: 70px;}
+
  display: grid;
 +
  grid-template-areas:
 +
    "icon achievement achievement image"
 +
    "icon .          action      image";
 +
  grid-template-columns: auto 1em 1fr auto;
 +
  gap: 0 1ch;
 +
  align-items: center;
 +
 
 +
  .ribbon2-icon {
 +
    grid-area: icon;
 +
    display: flex;
 +
    place-items: center;
 +
    img {
 +
      width: 3em;
 +
      height: 3em;
 +
    }
 +
  }
 +
 
 +
  .ribbon2-achievement {
 +
    font-weight: bold;
 +
    grid-area: achievement;
 +
  }
 +
 
 +
  .ribbon2-action {
 +
    grid-area: action;
 +
  }
  
.xkcd-ribbon2-xtra, .xkcd-ribbon2-imag {
+
  .ribbon2-image {
  padding-left: 10px;
+
    grid-area: image;
  border-left: 1px solid lightgray;
+
    display: flex;
  align-self: stretch;
+
    place-items: center;
  display: flex;
+
    align-self: stretch;
  align-items: center;
+
  }
  grid-row: span 2;
 
 
}
 
}
  
 +
.ribbon2[data-ribbon2-theme=mini], .ribbon2[data-ribbon2-theme=micro] {
 +
  display: flex;
 +
  flex-direction: row;
 +
  gap: 1ch;
  
.xkcd-ribbon2-theme-mini {
+
  .ribbon2-icon img {
  grid-template-areas: "icon achv actn . imag xtra";
+
    width: 3ch;
  grid-template-columns: min-content min-content min-content auto min-content min-content;
+
    height: 3ch;
  padding: 0;
+
   }
}
 
.xkcd-ribbon2-theme-mini .xkcd-ribbon2-actn {
 
  padding-left: 0;
 
}
 
.xkcd-ribbon2-theme-mini .xkcd-ribbon2-achv::after {
 
  /* for some reason `content: " ";` doesn't work */
 
   content: "&nbsp;";
 
}
 
.xkcd-ribbon2-theme-mini img {
 
  width: 22px;
 
  height: 22px;
 
 
}
 
}
  
}}<div class="xkcd-ribbon2-wrapper">
+
}}<div class="ribbon2-wrapper">
  <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}}}">
+
<div class="ribbon2" style="border-left-color:{{{color|#e8bf28}}}" data-ribbon2-theme="{{#var:ribbontheme|default}}">
    <div class="xkcd-ribbon2-icon">{{{iconcode|[[File:{{{icon|Landgeohash.png}}}|70px]]}}}</div>
+
  <div class="ribbon2-icon">{{{iconcode|[[File:{{{icon|Landgeohash.png}}}|70px]]}}}</div>
    <div class="xkcd-ribbon2-achv">{{{achievement}}}</div>
+
  <div class="ribbon2-achievement">{{{achievement}}}</div>
    <div class="xkcd-ribbon2-actn">{{{action}}}</div>
+
  <div class="ribbon2-action">{{{action}}}</div>
    {{#if:{{{image|}}}|<div class="xkcd-ribbon2-imag">[[File:{{{image}}}|44px]]</div>|}}
+
<div class="ribbon2-image">{{#if:{{{image|}}}|[[Image:{{{image}}}|50px]]}}</div>
    {{#if:{{{extra|}}}|<div class="xkcd-ribbon2-xtra">{{{extra}}}</div>|}}
+
</div>
  </div>
 
 
</div><noinclude>
 
</div><noinclude>
  
 
== Tests ==
 
== Tests ==
 
+
[[File:Frozen.png|right|220px]]
{{#vardefine:ribbonwidth|100%}}
+
asdfasdf
 +
{{Ribbon2|action={{Lipsum}}|image=2020-02-08_43_-79_SIGSTKFLT-stupidgrin.jpg}}
 +
{{Dark Ages|latitude=51|longitude=-1|date=2019-11-29|name=[[User:DanQ|DanQ]]|image=Vlcsnap-2019-11-29-15h55m24s199.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}}
 
{{Ribbon2}}
 
{{Ribbon2}}
 +
=== Mini ===
 
{{#vardefine:ribbontheme|mini}}
 
{{#vardefine:ribbontheme|mini}}
 
{{Ribbon2}}
 
{{Ribbon2}}
 +
{{Ribbon2|action={{Lipsum}}}}
 +
=== Micro ===
 +
{{#vardefine:ribbontheme|micro}}
 +
{{Ribbon2|achievement=foo|expedition=bar}}
 +
 +
== TODO ==
 +
 +
* <s>Handle long actions in mini and micro themes</s>
 +
* <s>Split themes into their own templates?</s>
 +
* <s>Make the <nowiki>{{{image}}}</nowiki> parameter work</s>
  
 
</noinclude>
 
</noinclude>

Latest revision as of 02:18, 18 November 2024

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

Tests

Frozen.png

asdfasdf

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
Frozen.png
SIGSTKFLT earned the Frozen Geohash Achievement
by reaching the (43, -79) geohash on 2020-02-08 while the temperature was -17°C.
2020-02-08 43 -79 SIGSTKFLT-stupidgrin.jpg
Landgeohash.png
{{{achievement}}}
{{{action}}}

Mini

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.

Micro

Landgeohash.png
foo
{{{action}}}

TODO

  • Handle long actions in mini and micro themes
  • Split themes into their own templates?
  • Make the {{{image}}} parameter work