denertog
denertog
KPCKevin Powell - Community
Created by denertog on 6/2/2023 in #front-end
gap vs margin
regarding the latest video on gap vs margin at the end there was the spacing between those form-groups would there be a difference (in outcome or styling semantics) if instead of
form {
display: grid;
gap: 1em;
}
form {
display: grid;
gap: 1em;
}
it would have been done
.form-group {
margin-block: 1em;
}
.form-group {
margin-block: 1em;
}
because that .form-group selector was already there anyway
7 replies
KPCKevin Powell - Community
Created by denertog on 5/16/2023 in #front-end
how does the browser calculate width of flex items?
https://jsfiddle.net/FreTimmerman/1uo87vfb/12/ asking this for a friend. he (and i) wants to know why on the top row, the text is wrapping however the element itself is much wider how can it be solved that the block only takes the space needed for those 2 lines of text? min-content obviously doesn't work since it then wraps into 3 lines
16 replies
KPCKevin Powell - Community
Created by denertog on 4/20/2023 in #front-end
vanilla javascript to make component-based UI
I'm working on a side project at the moment, which is a boardgame. I already implemented the complete game to be usable via CLI but now I want to make a web-interface as well. I was wondering whether it'd be feasible to make that component-based without any of the big frameworks (angular/react/vue/svelte) as long as i combine it with RxJS to handle the events and DOM manipulation. And if feasible, how you would approach building these components (e.g. regular HTML files scattered all over the place, ...)
32 replies
KPCKevin Powell - Community
Created by denertog on 4/11/2023 in #front-end
dealing with dynamic components
given this code, how should i close that alert? that onHandleError() never gets called :/
//auth.component.html
<app-alert *ngIf="alertHost" (closingEvent)="onHandleError()"></app-alert>

//alert.component.html
<div class="backdrop" (click)="onClose()"></div>
<div class="alert-box">
<p>{{ message }}</p>
<div class="alert-box-actions">
<button class="btn btn-primary" (click)="onClose()">Close</button>
</div>
</div>
//auth.component.html
<app-alert *ngIf="alertHost" (closingEvent)="onHandleError()"></app-alert>

//alert.component.html
<div class="backdrop" (click)="onClose()"></div>
<div class="alert-box">
<p>{{ message }}</p>
<div class="alert-box-actions">
<button class="btn btn-primary" (click)="onClose()">Close</button>
</div>
</div>
//auth.component.ts
@ViewChild(AlertComponent, {static: true}) alertHost!: AlertComponent;

onHandleError(){
console.log("handling error");
this.viewContainerRef.remove();
}

private showErrorAlert(errorMessage: string){
const viewContainerRef = this.alertHost.viewContainerRef;
viewContainerRef.clear();

const alertRef = viewContainerRef.createComponent<AlertComponent>(AlertComponent);
alertRef.instance.message = errorMessage;
}
//auth.component.ts
@ViewChild(AlertComponent, {static: true}) alertHost!: AlertComponent;

onHandleError(){
console.log("handling error");
this.viewContainerRef.remove();
}

private showErrorAlert(errorMessage: string){
const viewContainerRef = this.alertHost.viewContainerRef;
viewContainerRef.clear();

const alertRef = viewContainerRef.createComponent<AlertComponent>(AlertComponent);
alertRef.instance.message = errorMessage;
}
1 replies
KPCKevin Powell - Community
Created by denertog on 3/31/2023 in #front-end
padEnd not padding equally among multiple lines
4 replies
KPCKevin Powell - Community
Created by denertog on 1/12/2023 in #back-end
more than one row returned
Can anyone explain me why this query results in an error more than 1 row returned by a subquery used as an expression select a.*, (select b.x from b where a.id = b.a_id) from a especially since the problem is resolved once i change it to this select a.*, case when (select true from b where a.id = b.a_id and b.x = true) = true then true else false end
2 replies
KPCKevin Powell - Community
Created by denertog on 12/18/2022 in #front-end
async await in loops
I have this code, but I don't understand why this all gets printed right after each other, where I would expect that the rl.question call gives me a prompt in terminal which waits for input. useful information is that before this piece is run, there is another part that also uses the rl.question where it actually waits for that user input in the terminal (and then uses that as expected in the callback)
for (let round = 1; round <= this.GAME_ROUNDS; round++) {
for (let player of this.players) {
this.startTurn();
console.log(`starting turn for player in round ${round}`);
console.log("" + player);

rl.question("What do you want to do now? (F) Forge / (H) Heroic feat",
(answer) => {console.log(`excellent choice that ${answer}, but this isn't implemented yet`)});
}
}
for (let round = 1; round <= this.GAME_ROUNDS; round++) {
for (let player of this.players) {
this.startTurn();
console.log(`starting turn for player in round ${round}`);
console.log("" + player);

rl.question("What do you want to do now? (F) Forge / (H) Heroic feat",
(answer) => {console.log(`excellent choice that ${answer}, but this isn't implemented yet`)});
}
}
3 replies
KPCKevin Powell - Community
Created by denertog on 11/14/2022 in #front-end
horizontal scrolling for offcanvas
I'm implementing (or working on implementing) the News homepage challenge from FEM. I do have trouble on getting the stuff right with the offcanvas menu. It's hiding correctly like I want it to, however there is still some horizontal scrolling available (unlike what I want) How should i fix this? Code can be found at https://github.com/thomashertog/frontendmentor-news-homepage
14 replies
KPCKevin Powell - Community
Created by denertog on 11/10/2022 in #front-end
when to use subgrid
i want to start another FEM challenge -> https://www.frontendmentor.io/challenges/news-homepage-H6SWTa1MFl when i look at the design, i feel like subgrid is appropriate, but i don't have any experience (yet) using it, and just wanted to check whether that is overkill or not. what do you guys think?
15 replies
KPCKevin Powell - Community
Created by denertog on 10/17/2022 in #front-end
Typescript bootcamp
I want to get started with typescript. Can someone point me to a great tutorial/getting started thingy? I already have some JS knowledge (i know the concepts and can develop small projects with it)
2 replies