Skip to content

Commit 4734dac

Browse files
authored
Merge pull request #559 from MurhafSousli/dev
Utilise CSS variable and simplify themes structure
2 parents 865c926 + 526ff04 commit 4734dac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+482
-651
lines changed

CHANGELOG.MD

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Changelog
22

3+
## 9.0.0
4+
5+
### Breaking changes
6+
7+
- refactor(button, buttons, popup): The input `[size]` has been removed from all share components and global options, you can change the size of a button using the CSS variable `--sb-font-size`, in [843940e](https://github.com/MurhafSousli/ngx-sharebuttons/pull/559/commits/843940ec5e115a55092f8233cd74d8f3cc96fdc0).
8+
- refactor(button, buttons, popup): light and dark themes files has been merged into a single file, example:
9+
10+
#### Example:
11+
12+
**before:**
13+
14+
```scss
15+
// To import 'material-light-theme', the light theme from the following path:
16+
@import "~ngx-sharebuttons/themes/material/material-light-theme";
17+
// To import 'material-dark-theme', the dark theme from the following path:
18+
@import "~ngx-sharebuttons/themes/material/material-dark-theme";
19+
```
20+
21+
**after:**
22+
23+
```scss
24+
// Light or dark theme is imported from the same file
25+
@import "~ngx-sharebuttons/themes/material";
26+
```
27+
28+
- feat(button, buttons, popup): Add CSS variables, closes [#549](https://github.com/MurhafSousli/ngx-sharebuttons/issues/549) in [5c575d3](https://github.com/MurhafSousli/ngx-sharebuttons/pull/559/commits/5c575d3207a3aaed384ecd5f62520dc08b266f34).
29+
- fix(popup): Fix text styles in pop up button component, closes [#516](https://github.com/MurhafSousli/ngx-sharebuttons/issues/516) in [c6bbf53](https://github.com/MurhafSousli/ngx-sharebuttons/pull/559/commits/c6bbf53a4831f8303ba7baac5affd1512d948352).
30+
331
## 8.1.0
432

533
- Upgrade to Angular 12

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016-2020 Murhaf Sousli
3+
Copyright (c) 2016-2021 Murhaf Sousli
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

projects/ngx-sharebuttons-demo/src/app/pages/button-c/button-c.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class ButtonCComponent implements OnInit {
2121
name: '<share-button>',
2222
npm: `npm i ngx-sharebuttons
2323
npm i @fortawesome/fontawesome-svg-core @fortawesome/angular-fontawesome @fortawesome/free-solid-svg-icons @fortawesome/free-brands-svg-icons`,
24-
styles: `@import '~ngx-sharebuttons/button/themes/default/default-theme';`,
24+
styles: `@import '~ngx-sharebuttons/button/themes/default';`,
2525
examples: `<share-button button="facebook" text="Share" [showText]="true"></share-button>
2626
<share-button button="twitter" text="Tweet" [showText]="true"></share-button>
2727
<share-button button="pinterest" text="pin"></share-button>`,
Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +0,0 @@
1-
2-
//.share-container {
3-
// display: flex;
4-
// align-items: center;
5-
// margin: 1rem 0;
6-
// .share-count {
7-
// display: flex;
8-
// flex-direction: column;
9-
// align-items: center;
10-
// padding-right: 1rem;
11-
// margin-right: 1rem;
12-
// border-right: 2px solid $output-color;
13-
// h3 {
14-
// display: flex;
15-
// flex-direction: column-reverse;
16-
// font-size: 2.5rem;
17-
// margin: 0;
18-
// }
19-
// b {
20-
// font-size: .7rem;
21-
// }
22-
// }
23-
//}

projects/ngx-sharebuttons-demo/src/app/pages/buttons-c/buttons-c.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class ButtonsCComponent implements OnInit {
1717
code = {
1818
name: '<share-buttons>',
1919
example: '<share-buttons show="11"></share-buttons>',
20-
styles: `@import '~ngx-sharebuttons/themes/default/default-theme';`,
20+
styles: `@import '~ngx-sharebuttons/themes/default';`,
2121
npm: `npm i ngx-sharebuttons @angular/cdk
2222
npm i @fortawesome/fontawesome-svg-core @fortawesome/angular-fontawesome @fortawesome/free-solid-svg-icons @fortawesome/free-brands-svg-icons`,
2323
import: `import { ShareButtonsModule } from 'ngx-sharebuttons/buttons';

projects/ngx-sharebuttons-demo/src/app/pages/popup-buttons/popup-buttons.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ <h4>NPM</h4>
6060

6161
<mat-card>
6262
<mat-card-content>
63-
<lab component="share-popup-button"></lab>
63+
<lab component="popup-buttons"></lab>
6464
</mat-card-content>
6565
</mat-card>
6666
</section>

projects/ngx-sharebuttons-demo/src/app/pages/popup-buttons/popup-buttons.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class PopupButtonsComponent implements OnInit {
1919
name: '<share-popup-button>, <button shareButtonsPopup>',
2020
example: '<share-popup-button>Share</share-popup-button>',
2121
styles: `@import '~@angular/cdk/overlay-prebuilt.css'; /** Add this only for non-material project */
22-
@import '~ngx-sharebuttons/themes/default/default-theme';`,
22+
@import '~ngx-sharebuttons/themes/default';`,
2323
npm: `npm i ngx-sharebuttons @angular/cdk
2424
npm i @fortawesome/fontawesome-svg-core @fortawesome/angular-fontawesome @fortawesome/free-solid-svg-icons @fortawesome/free-brands-svg-icons`,
2525
import: `import { ShareButtonsPopupModule } from 'ngx-sharebuttons/popup';

projects/ngx-sharebuttons-demo/src/app/pages/styling/styling.component.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ <h1>Styling Guide</h1>
55

66
<div class="page-content container">
77

8+
<section>
9+
<section-title>Styling using CSS variables</section-title>
10+
11+
<p>Here are a list of the CSS variables you can use to change main styles:</p>
12+
13+
<hl-code [code]="cssVariables" [height]="400"></hl-code>
14+
15+
<p>If you still need to change other CSS rules, see the classes in the next section.</p>
16+
</section>
17+
818
<section>
919
<section-title>Create custom theme</section-title>
1020
<p>There are several classes to help you adjust your custom styles</p>

projects/ngx-sharebuttons-demo/src/app/pages/styling/styling.component.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ export class StylingComponent implements OnInit {
1616
stylingCode = `.sb-moon-theme {
1717
// share button wrapper
1818
.sb-wrapper {
19-
// You can get default button color using the CSS variable
20-
background-color: var(--button-color);
2119
// Content wrapper
2220
.sb-content {
2321
// Icon wrapper
@@ -29,7 +27,7 @@ export class StylingComponent implements OnInit {
2927
}
3028
3129
// For conditional styles
32-
// E.g. Apply when icon, text are shown
30+
// E.g. Apply only when icon, text are shown
3331
&.sb-show-icon.sb-show-text {
3432
// Icon wrapper
3533
.sb-icon {
@@ -41,6 +39,22 @@ export class StylingComponent implements OnInit {
4139
}
4240
}`;
4341

42+
cssVariables = `--sb-margin
43+
--sb-min-width
44+
--sb-height
45+
--sb-color
46+
--sb-background
47+
--sb-font-size
48+
--sb-icon-size
49+
--sb-padding
50+
--sb-text-padding
51+
--sb-border
52+
--sb-border-radius
53+
--sb-line-height
54+
--sb-text-shadow
55+
--sb-font-weight
56+
--sb-overflow`;
57+
4458
constructor(private titleService: Title) {
4559
}
4660

projects/ngx-sharebuttons-demo/src/app/pages/themes/themes.component.html

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ <h1>Themes</h1>
44
</header>
55

66
<div class="page-content container">
7-
87
<section>
98
<section-title> Icons only </section-title>
109
<share-buttons [theme]="theme" show="5" size="-1"></share-buttons>
@@ -15,18 +14,7 @@ <h1>Themes</h1>
1514
<share-buttons [theme]="theme" showText="true" show="5" size="-1"></share-buttons>
1615
</section>
1716

18-
<section>
19-
<section-title> Icons + names + counts </section-title>
20-
<share-buttons [theme]="theme" url="http://twitter.com/" showText="true" showCount="true" show="5" size="-1"></share-buttons>
21-
</section>
22-
23-
<section>
24-
<section-title> Icons + counts </section-title>
25-
<share-buttons [theme]="theme" url="http://twitter.com/" showCount="true" show="5" size="-1"></share-buttons>
26-
</section>
27-
2817
<theme-switcher (themeChange)="theme = $event"></theme-switcher>
29-
3018
</div>
3119

3220
<footer></footer>

0 commit comments

Comments
 (0)