Setup
Install Sass:
npm install -g sass
Install Typescript:
npm install -g typescript
Running
The command below will compile all .scss files from the ./sass folder and put it inside the ./css folder as .css files.
sass --watch sass:css
The command bellow will compile all .ts files inside the ./ts folder and put it inside the ./js folder as .js files.
tsc -w
Follow the steps below in order to create your own page on The Design Web.
- Fork this repo to your own GitHub account
- Clone the repo
- Run the
sasscommand above to compile the CSS assets. - Create a new folder with the name of your styling and design guidelines, be creative in this one. Note: Replace spaces with a dash (-).
- Inside your folder create an
index.htmlfile. - Inside the sass folder create a file named
<your-styleguide-name>.scss. - Reference the
.cssequivalent inside yourindex.htmlfile. - Add your page to the
main.tsfile. - Compile the typescript files.
- Most important step: Design your styleguide, have fun with this!
- When finished, checkout to a new branch with git.
- Push the the changes to your new branch.
- Go to the forked repo on GitHub, on your account.
- Create a new pull request to merge with the main repository.
- Wait unitl the owner approves your request.
- See your changes live on the Website.
Let's practice your Typescript skills!
Exercise
- Create a new file inside the
./tsfolder, name it<your-styleguide-name>.ts. - Reference the JavaSript equivalent of this file inside your
index.htmlfile.
Create a Typescript interface or type called Counter with the following attributes:
- Counter of type
numberwhich represents the current state of the counter - Name of type
stringwhich holds the name or title what the counter is counting for - Steps of type
numberthis holds the number of how fast the counter should increment or decrement - Pointer of type
booleanif the pointer istruethen the counter will increment, else decrement. - Freeze of type
booleanthis is a bonus functionality to make the counter stop counting
The interface has the following methods:
Increment(): void, which increments the counter by the given steps.Decrement(): void, which decrements the counter by the given steps.Faster(): void, this will make the counter count faster, by incrementing the steps attribute.SlowDown(): void, this will make the counter count slower.StopTheTime(): void, this will make the counter stop counting.
Next implement the interface by using a const.
If you have implemented all the methods then show the counter state on an HTML page. Where all of the methods are mapped to a button and the actions are invoked when the user clicks on a button.
Can you create a counter that counts automatically with a given time interval?
Can you React?
If you are done with the plain HTML implementation can you build a version using React? https://react.dev/ What are the main differences? To what problem does React provide a solution?