Skip to content

Commit 3b70fe9

Browse files
committed
chore: website responsiveness
1 parent 57381f2 commit 3b70fe9

File tree

7 files changed

+112
-55
lines changed

7 files changed

+112
-55
lines changed

README.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,42 @@ https://db-diagrams.firebaseapp.com/
77
## Installation
88

99
1. Install NuGet package `EntityFrameworkCore.Diagrams`
10-
2. Add middleware in your `Startup.Configure()` method: `app.AddEfDiagrams<ApplicationDbContext>();`. Use it only in development mode (`if (env.IsDevelopment())`): you don't want everyone in public see your entire data structure :) Here's an example of how your code might may look like:
10+
2. Use `AddEfDiagrams()` extension method in `Configure()` method of your Startup class to add middleware. Specify your DbContext type instead of ApplicationDbContext in the following example: `app.AddEfDiagrams<ApplicationDbContext>();`
11+
Here's how your Configure() method might look like after this step (notice commented line):
1112
```cs
12-
if (env.IsDevelopment())
13-
{
14-
app.AddEfDiagrams<ApplicationDbContext>();
15-
}
13+
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
14+
{
15+
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
16+
loggerFactory.AddDebug();
17+
18+
if (env.IsDevelopment())
19+
{
20+
app.UseDeveloperExceptionPage();
21+
app.UseBrowserLink();
22+
app.AddEfDiagrams<ApplicationDbContext>(); // <-- Here's the config for EntityFrameworkCore.Diargams
23+
}
24+
else
25+
{
26+
app.UseExceptionHandler("/Home/Error");
27+
}
28+
29+
app.UseStaticFiles();
30+
31+
app.UseMvc(routes =>
32+
{
33+
routes.MapRoute(
34+
name: "default",
35+
template: "{controller=Home}/{action=Index}/{id?}");
36+
});
37+
}
1638
```
17-
3. Start your app and open `/db-diagrams` page. You should see yor entity model diagram.
39+
3. Start your app and browse to `/db-diagrams page`. You should see the diagram now.
40+
41+
Notice that the middleware is added only in Development mode. This is important! Otherwise, any user in Production will se your model structure, which may not be desireable. This is not the case if you are developing public API, though.
42+
1843

44+
## Contributing
45+
Feel free to report any bugs or feature requests - just create an issue. Contributions are appreciated!
1946

20-
Feel free to report any bugs or feature requests. Contributions are appreciated!
47+
## License
48+
MIT

website/src/app/components/footer/footer.component.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ footer {
2121
.footer-logo {
2222
border-radius: 50%;
2323
overflow: hidden;
24+
flex: 0 0 auto;
2425

2526
img {
2627
height: 50px;
2728
}
2829
}
2930

3031
.footer-links {
32+
min-width: 180px;
33+
3134
@media (max-width: 488px) {
32-
flex-basis: 80%;
35+
// flex-basis: 80%;
3336
}
3437

3538
ul {
@@ -58,6 +61,7 @@ footer {
5861
flex: 1;
5962
display: flex;
6063
justify-content: flex-end;
64+
min-width: 180px;
6165
}
6266
}
6367
}

website/src/app/components/getting-started/getting-started.component.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h2>Step 1: Install EntityFrameworkCore.Diagrams</h2>
1212
<h2>Step 2: Add middleware</h2>
1313
<p>Use <code>AddEfDiagrams()</code> extension method in <code>Configure()</code> method of your <code>Startup</code> class to add middleware. Specify your <code>DbContext</code> type instead of <code>ApplicationDbContext</code> in the following example:</p>
1414
<pre><code efdSyntaxHighlight="cs">app.AddEfDiagrams&lt;ApplicationDbContext&gt;();</code></pre>
15-
<p>Here's how your <code>Configure()</code> method might look like after this step:</p>
15+
<p>Here's how your <code>Configure()</code> method might look like after this step (notice highlighted line):</p>
1616
<pre><code efdSyntaxHighlight="cs">public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
1717
&#123;
1818
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
@@ -22,7 +22,7 @@ <h2>Step 2: Add middleware</h2>
2222
&#123;
2323
app.UseDeveloperExceptionPage();
2424
app.UseBrowserLink();
25-
app.AddEfDiagrams&lt;ApplicationDbContext&gt;();
25+
<strong>app.AddEfDiagrams&lt;ApplicationDbContext&gt;();</strong>
2626
&#125;
2727
else
2828
&#123;
@@ -38,7 +38,6 @@ <h2>Step 2: Add middleware</h2>
3838
template: "&#123;controller=Home&#125;/&#123;action=Index&#125;/&#123;id?&#125;");
3939
&#125;);
4040
&#125;</code></pre>
41-
<p>The only change to your existing code is one extra line: <code>app.AddEfDiagrams&lt;ApplicationDbContext&gt;();</code></p>
4241
<p>Notice that the middleware is added only in Development mode. This is important! Otherwise, any user in Production will se your model structure, which may not be desireable. This is not the case if you are developing public API, though.</p>
4342

4443
<h2>Step 3: Start your app and see the diagram</h2>

website/src/app/components/getting-started/getting-started.component.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ main {
2525
margin: 20px auto;
2626
max-width: 940px;
2727

28-
@media (max-width: 488px) {
28+
@media (max-width: 972px) {
2929
margin: 16px;
3030
}
3131

@@ -42,11 +42,13 @@ main {
4242

4343
h2, p {
4444
color: rgba(0, 0, 0, 0.87);
45+
overflow-x: auto;
4546
}
4647

4748
pre,
4849
code {
4950
font-family: Roboto Mono,monospace;
51+
white-space: pre;
5052
}
5153

5254
pre {
@@ -58,9 +60,17 @@ main {
5860
padding: 20px;
5961
white-space: pre-wrap;
6062
font-size: 14px;
63+
overflow-x: auto;
6164

6265
code {
6366
font-size: 90%;
67+
68+
strong {
69+
padding: 2px 8px;
70+
margin: 0 -8px;
71+
background: rgba(mat-color(map-get($efd-app-theme, primary)), 0.16);
72+
border-radius: 2px;
73+
}
6474
}
6575
}
6676
}

website/src/app/components/homepage/homepage.component.scss

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
@import '~@angular/material/theming';
22
@import '../../../theme';
33

4+
$header-breakpoint: 503px;
5+
46
header {
57
background: mat-color(map-get($efd-app-theme, primary));
68
height: 300px;
@@ -10,7 +12,7 @@ header {
1012
text-align: center;
1113
color: rgba(255, 255, 255, 0.87);
1214

13-
@media (max-width: 488px) {
15+
@media (max-width: $header-breakpoint) {
1416
padding-top: 8px;
1517
}
1618

@@ -20,7 +22,7 @@ header {
2022
line-height: 56px;
2123
margin: 15px 0 15px 0;
2224

23-
@media (max-width: 488px) {
25+
@media (max-width: $header-breakpoint) {
2426
margin-top: 0;
2527
}
2628
}
@@ -35,7 +37,7 @@ header {
3537
a {
3638
margin-top: 36px;
3739

38-
@media (max-width: 488px) {
40+
@media (max-width: $header-breakpoint) {
3941
margin-top: 16px;
4042
}
4143
}
@@ -59,21 +61,13 @@ main {
5961
justify-content: center;
6062
box-sizing: border-box;
6163

62-
.img-container,
63-
.text-container {
64-
max-width: 50%;
65-
}
66-
67-
.img-container {
68-
64+
@media (max-width: 952px) {
65+
margin: 16px;
6966
}
7067

7168
.text-container {
72-
73-
@media (max-width: 488px) {
74-
flex: 1;
75-
max-width: none;
76-
}
69+
max-width: 450px;
70+
margin: auto;
7771

7872
h2 {
7973
font-size: 25px;
@@ -83,7 +77,7 @@ main {
8377
}
8478

8579
p {
86-
font-size: 16px;
80+
font-size: 16px;
8781
font-weight: 400;
8882
line-height: 28px;
8983
margin: 0 0 24px 0;

website/src/app/components/navbar/navbar.component.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
<ng-content></ng-content>
1010
</span>
1111
<span>
12-
<a href="https://github.com/EvAlex/ef-db-diagrams" target="_blank" md-button>
13-
<img src="/assets/github-circle-white-transparent.svg" alt="GitHub" class="github-logo">
14-
Github
12+
<a class="github-logo" href="https://github.com/EvAlex/ef-db-diagrams" target="_blank" md-button>
13+
<img src="/assets/github-circle-white-transparent.svg" alt="GitHub">
14+
<span>Github</span>
15+
</a>
16+
<a class="github-logo-sm" href="https://github.com/EvAlex/ef-db-diagrams" target="_blank" md-icon-button>
17+
<img src="/assets/github-circle-white-transparent.svg" alt="GitHub">
1518
</a>
1619
</span>
1720
</md-toolbar>
Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,52 @@
11

2-
.title {
3-
flex: 0 0 160px;
4-
padding-left: 16px;
5-
text-decoration: none;
6-
7-
img {
8-
height: 32px;
9-
vertical-align: middle;
10-
margin-right: 8px;
11-
}
2+
md-toolbar {
3+
overflow-x: hidden;
124

13-
span {
14-
vertical-align: middle;
15-
}
5+
.title {
6+
flex: 0 0 160px;
7+
padding-left: 16px;
8+
text-decoration: none;
9+
margin-top: 1px;
10+
11+
img {
12+
height: 32px;
13+
vertical-align: middle;
14+
margin-right: 8px;
15+
}
1616

17-
@media (max-width: 600px) {
18-
flex: 0 0 120px;
17+
span {
18+
vertical-align: middle;
19+
}
20+
21+
@media (max-width: 600px) {
22+
flex: 0 0 120px;
23+
}
1924
}
2025

21-
@media (max-width: 320px) {
22-
flex: 0 0 96px;
26+
.content {
27+
flex: 1;
2328
}
24-
}
2529

26-
.content {
27-
flex: 1;
28-
}
30+
.github-logo {
2931

30-
.github-logo {
31-
height: 21px;
32-
margin: 0 7px 2px 0;
32+
@media (max-width: 488px) {
33+
display: none;
34+
}
35+
36+
&-sm {
37+
display: none;
38+
39+
@media (max-width: 488px) {
40+
display: inline-block;
41+
}
42+
}
43+
}
44+
45+
.github-logo,
46+
.github-logo-sm {
47+
img {
48+
height: 22px;
49+
margin: 0 6px;
50+
}
51+
}
3352
}

0 commit comments

Comments
 (0)