0.0.12 • Published 3 years ago

@steinv/filippine v0.0.12

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

GitHub license Filippine

Filippine puzzle with Angular Example

Usage

  1. Install from npm npm install @steinv/filippine

  2. Import the module in your app.module.ts

import { FilippineModule } from '@steinv/filippine';

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    FilippineModule,
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
  1. Add the filippine directive in your component template
    <filippine 
      [configuration]="configuration" 
      (answer)="questionAnswered($event)" 
      (completed)="puzzleCompleted($event)">
    </filippine>
  1. Add a configuration and handle output for your filippine puzzle in your component
  public configuration: Configuration = {
    questions: [
      {question: 'q1?', answer: 'abcdefghijklm', answerLength: 13, answerPosition: 10},
      {question: 'q2?', answer: 'abcd', answerLength: 4, answerPosition: 1},
      {question: 'q3?', answer: 'abcde', answerLength: 5, answerPosition: 2},
      {question: 'q4?', answer: 'abcdefgh', answerLength: 8, answerPosition: 2},
    ]
  }

  public questionAnswered(reply: Answer) {
    /**
     * do something with the reply: Answer 
     * reply.question
     * reply.answer
     */
  }

  public puzzleCompleted(result: boolean) {
    /**
     * do something with the result: boolean 
     */
     if (result) {
      console.log('well done!');
     } else {
      console.log('Uh-Oh looks like you made a mistake');
     }
  }

Style

You can override the used css selectors to define your own custom styling

/* grid-tiles used for spacing */
.spacer {
  background-color: transparent; 
  border: none;
  box-shadow: none;
}
/* grid-tiles used for input */
.input {
    background-color: white;
    border: 1px solid black;
}
/* highlighted input grid-tiles */
.highlight {
    background-color: yellow;
}
0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago