Skip to content

Commit

Permalink
Remove component styling (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcere authored Oct 12, 2018
1 parent 0757442 commit bb04531
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 46 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Jean-Francois Cere
Copyright (c) 2017-2018 Jean-Francois Cere

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
36 changes: 35 additions & 1 deletion demo/src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,40 @@ section:first-of-type {
/* materialize global css reset for demo puprose */
markdown {
::ng-deep {
blockquote {
padding: 0 1em;
color: rgba(0,0,0,0.535);
border-left: 0.25em solid rgba(0,0,0,0.11);
}

table {
border-spacing: 0;
border-collapse: collapse;
margin-bottom: 16px;

th,
td {
padding: 6px 13px;
border: 1px solid #ddd;

&[align="left"] {
text-align: left;
}

&[align="center"] {
text-align: center;
}

&[align="right"] {
text-align: right;
}
}

tr:nth-child(2n) {
background-color: rgba(0,0,0,0.03);
}
}

ul {
list-style-type: inherit;
padding-left: 40px !important;
Expand All @@ -146,4 +180,4 @@ markdown {
list-style-type: circle;
}
}
}
}
37 changes: 0 additions & 37 deletions lib/src/markdown.component.scss

This file was deleted.

11 changes: 5 additions & 6 deletions lib/src/markdown.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import { MarkdownService } from './markdown.service';
// tslint:disable-next-line:component-selector
selector: 'markdown, [markdown]',
template: '<ng-content></ng-content>',
styleUrls: ['./markdown.component.scss'],
})
export class MarkdownComponent implements AfterViewInit {
private _data: string;
private _src: string;

private get _isTranscluded() {
return !this._data && !this._src;
}

@Input()
get data(): string { return this._data; }
set data(value: string) {
Expand All @@ -37,17 +40,13 @@ export class MarkdownComponent implements AfterViewInit {
@Output() error = new EventEmitter<string>();
@Output() load = new EventEmitter<string>();

get isTranscluded(): boolean {
return !this.data && !this.src;
}

constructor(
public element: ElementRef,
public markdownService: MarkdownService,
) { }

ngAfterViewInit() {
if (this.isTranscluded) {
if (this._isTranscluded) {
this.render(this.element.nativeElement.innerHTML, true);
}
}
Expand Down
1 change: 0 additions & 1 deletion lib/src/markdown.module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { errorSrcWithoutHttpClient } from './markdown.service';
<markdown [data]="markdown"></markdown>
</ng-template>
`,
styleUrls: ['./markdown.component.scss'],
})
class HostComponent {
markdown = '# Super title';
Expand Down

0 comments on commit bb04531

Please sign in to comment.