Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(openchallenges): add link to our Discord server to the OC navbar #2283

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@use 'sass:map';
@use '@angular/material' as mat;

@mixin color($theme) {
$config: mat.get-color-config($theme);
$primary: map.get($config, primary);
$accent: map.get($config, accent);
$warn: map.get($config, warn);
$background: map.get($config, background);
$foreground: map.get($config, foreground);

// add color-related scss here
}

@mixin typography($theme) {}

@mixin theme($theme) {
$color-config: mat.get-color-config($theme);
@if $color-config != null {
@include color($theme);
}

$typography-config: mat.get-typography-config($theme);
@if $typography-config != null {
@include typography($theme);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<a
mat-button
class="docs-button"
[href]="href"
aria-label="OpenChallenges Discord server"
target="_blank"
rel="noreferrer"
>
<img
alt="OpenChallenges Discord server"
class="discord-logo"
src="/openchallenges-assets/images/discord-icon.svg"
/>
{{ label }}
</a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.discord-logo {
height: 21px;
margin: 0 7px 2px 0;
vertical-align: middle;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { CommonModule } from '@angular/common';
import { Component, Input } from '@angular/core';
import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';

@Component({
selector: 'openchallenges-discord-button',
standalone: true,
imports: [CommonModule, MatButtonModule],
templateUrl: './discord-button.component.html',
styleUrls: ['./discord-button.component.scss'],
})
export class DiscordButtonComponent {
@Input({ required: false }) label = 'Discord';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use a more descriptive label here? e.g. "Contact us on Discord"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Join us on Discord"? (a bit shorter - I will post a preview soon)

@Input({ required: false }) href = 'https://discord.gg/6PGt7nkcwG';
}
2 changes: 2 additions & 0 deletions libs/openchallenges/ui/src/lib/navbar/navbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

<div class="flex-spacer"></div>

<openchallenges-discord-button />

<!-- <a mat-button class="navbar-item" *ngIf="!isLoggedIn" routerLink="/login" aria-label="Log In">
Log In
</a> -->
Expand Down
12 changes: 6 additions & 6 deletions libs/openchallenges/ui/src/lib/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
import { Avatar } from '../avatar/avatar';
import { EMPTY_AVATAR } from '../avatar/mock-avatars';
import { MenuItem } from '../user-button/menu-item';
import { NavbarSection } from './navbar-section';
import { ButtonGithubComponent } from '../button-github/button-github.component';
import { CommonModule } from '@angular/common';
import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
import { RouterModule } from '@angular/router';
import { UserButtonComponent } from '../user-button/user-button.component';
import { DiscordButtonComponent } from '../discord-button/discord-button.component';
import { NavbarSection } from './navbar-section';

@Component({
selector: 'openchallenges-navbar',
Expand All @@ -16,8 +16,8 @@ import { UserButtonComponent } from '../user-button/user-button.component';
CommonModule,
RouterModule,
MatButtonModule,
ButtonGithubComponent,
UserButtonComponent,
DiscordButtonComponent,
],
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.scss'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,4 @@ describe('OrganizationCardComponent', () => {
size: 160,
});
});

// it('login property of org should be used for orgAvatar name', () => {
// component.organization.name = '';
// fixture.detectChanges();
// expect(component.organizationAvatar).toEqual({
// name: MOCK_ORGANIZATIONS[0].login.replace(/-/g, ' '),
// src: '',
// size: 160,
// });
// });
});