blog: Rubiks' Cube Scrambler post
Implement the rubiks-cube-scrambler custom element, including JS and template files. Put these things in the body-extras.html partial that the termlite theme added. resource-builders: Update submodule commit termlite: Update submodule commit
This commit is contained in:
		
							parent
							
								
									cb16a35020
								
							
						
					
					
						commit
						122e55b1fa
					
				
					 7 changed files with 221 additions and 2 deletions
				
			
		
							
								
								
									
										4
									
								
								layouts/partials/base/body-extras.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								layouts/partials/base/body-extras.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
{{ if .HasShortcode "rubiks/scrambler" }}
 | 
			
		||||
  {{ partial "rubiks/scrambler-template.html" . }}
 | 
			
		||||
  {{ partial "resource_builders/script.html" (dict "resource" "scripts/rubiks/scrambler.js") }}
 | 
			
		||||
{{ end }}
 | 
			
		||||
							
								
								
									
										61
									
								
								layouts/partials/rubiks/scrambler-template.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								layouts/partials/rubiks/scrambler-template.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,61 @@
 | 
			
		|||
<template id="rubiks-cube-scrambler-template">
 | 
			
		||||
  <ol class="scrambler__move-list"></ol>
 | 
			
		||||
  <div class="scrambler__pattern-length">
 | 
			
		||||
    <label for="pattern-length" class="scrambler__label">Length</label>
 | 
			
		||||
    <input type="text" name="pattern-length">
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="scrambler__scramble">
 | 
			
		||||
    <button name="scramble" class="scrambler__button">Scramble!</button>
 | 
			
		||||
  </div>
 | 
			
		||||
  <style>
 | 
			
		||||
    .scrambler__move-list {
 | 
			
		||||
      display: grid;
 | 
			
		||||
      font-family: var(--font-family-monospace);
 | 
			
		||||
      gap: var(--space-xxs);
 | 
			
		||||
      grid-template-columns: repeat(7, 3ch);
 | 
			
		||||
      list-style: none;
 | 
			
		||||
      margin-block: 0;
 | 
			
		||||
      padding-inline: 0;
 | 
			
		||||
 | 
			
		||||
      .scrambler__move {
 | 
			
		||||
        justify-self: center;
 | 
			
		||||
        margin: 1px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .scrambler__move--start {
 | 
			
		||||
        justify-self: start;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .scrambler__move--end {
 | 
			
		||||
        justify-self: end;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .scrambler__scramble,
 | 
			
		||||
    .scrambler__pattern-length
 | 
			
		||||
    {
 | 
			
		||||
      font-size: var(--text-s);
 | 
			
		||||
      margin-block-start: var(--space-s);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .scrambler__button {
 | 
			
		||||
      font-size: var(--text-s);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .scrambler__label {
 | 
			
		||||
      color: var(--text-color-secondary);
 | 
			
		||||
      font-family: var(--font-family-monospace);
 | 
			
		||||
      text-transform: uppercase;
 | 
			
		||||
 | 
			
		||||
      &::after {
 | 
			
		||||
        content: " = ";
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    input[name="pattern-length"] {
 | 
			
		||||
      font-size: var(--text-s);
 | 
			
		||||
      text-align: end;
 | 
			
		||||
      width: 4ch;
 | 
			
		||||
    }
 | 
			
		||||
  </style>
 | 
			
		||||
</template>
 | 
			
		||||
							
								
								
									
										1
									
								
								layouts/shortcodes/rubiks/scrambler.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								layouts/shortcodes/rubiks/scrambler.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
<rubiks-cube-scrambler></rubiks-cube-scrambler>
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue