Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Commits
e9831bb8
Unverified
Commit
e9831bb8
authored
3 years ago
by
Bekerle, Patrizio
Browse files
Options
Downloads
Patches
Plain Diff
Add dbp-translated documentation and demonstration
parent
f27593b9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#44945
passed
3 years ago
Stage: test
Stage: deploy
Stage: e2e
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/common/README.md
+16
-0
16 additions, 0 deletions
packages/common/README.md
packages/common/dbp-common-demo.js
+15
-1
15 additions, 1 deletion
packages/common/dbp-common-demo.js
packages/common/index.js
+2
-0
2 additions, 0 deletions
packages/common/index.js
with
33 additions
and
1 deletion
packages/common/README.md
+
16
−
0
View file @
e9831bb8
...
...
@@ -20,3 +20,19 @@ Variables like `--dbp-override-icon-<icon-name>` can be used to override the ico
Example CSS:
`html { --dbp-override-icon-cloud: url(/icons/cloud.svg); }`
## Translated Web Component
You can use this web component to show translated html.
```
html
<dbp-translated
subscribe=
"lang"
>
<div
slot=
"de"
>
Dieser Text is Deutsch und wird Englisch werden wenn man die Sprache auf Englisch stellt.
</div>
<div
slot=
"en"
>
This text is English and will be German if the language is changed to German.
</div>
</dbp-translated>
```
The English or German text will be shown according to the
`lang`
attribute.
This diff is collapsed.
Click to expand it.
packages/common/dbp-common-demo.js
+
15
−
1
View file @
e9831bb8
...
...
@@ -3,7 +3,7 @@ import {css, html, LitElement} from 'lit-element';
import
{
ScopedElementsMixin
}
from
'
@open-wc/scoped-elements
'
;
import
*
as
commonUtils
from
'
./utils.js
'
;
import
*
as
commonStyles
from
'
./styles.js
'
;
import
{
getIconCSS
,
Icon
,
MiniSpinner
,
Button
,
LoadingButton
,
Spinner
,
InlineNotification
}
from
'
./index.js
'
;
import
{
getIconCSS
,
Icon
,
MiniSpinner
,
Button
,
LoadingButton
,
Spinner
,
InlineNotification
,
Translated
}
from
'
./index.js
'
;
export
class
DbpCommonDemo
extends
ScopedElementsMixin
(
LitElement
)
{
constructor
()
{
...
...
@@ -21,6 +21,7 @@ export class DbpCommonDemo extends ScopedElementsMixin(LitElement) {
'
dbp-loading-button
'
:
LoadingButton
,
'
dbp-auth
'
:
customElements
.
get
(
'
dbp-auth
'
),
'
dbp-inline-notification
'
:
InlineNotification
,
'
dbp-translated
'
:
Translated
,
};
}
...
...
@@ -197,6 +198,19 @@ html {
<dbp-inline-notification summary="Item deleted" body="Item <b>foo</b> was deleted!" type="warning"></dbp-inline-notification>
</div>
</div>
<div class="content">
<h2>Translated text</h2>
<div class="control" id="dbp-translated-demo">
<dbp-translated subscribe="lang">
<div slot="de">
Dieser Text is Deutsch und wird Englisch werden wenn man die Sprache auf Englisch stellt.
</div>
<div slot="en">
This text is English and will be German if the language is changed to German.
</div>
</dbp-translated>
</div>
</div>
</section>
`
;
}
...
...
This diff is collapsed.
Click to expand it.
packages/common/index.js
+
2
−
0
View file @
e9831bb8
...
...
@@ -5,6 +5,7 @@ import {MiniSpinner} from './src/mini-spinner.js';
import
{
Button
,
LoadingButton
}
from
'
./src/button.js
'
;
import
{
Spinner
}
from
'
./src/spinner.js
'
;
import
{
InlineNotification
}
from
'
./src/inline-notification.js
'
;
import
{
Translated
}
from
"
./src/translated
"
;
export
{
EventBus
,
createLinkedAbortController
,
createTimeoutAbortSignal
};
export
{
getIconSVGURL
,
getIconCSS
,
Icon
};
...
...
@@ -12,5 +13,6 @@ export {MiniSpinner};
export
{
Button
,
LoadingButton
};
export
{
Spinner
};
export
{
InlineNotification
};
export
{
Translated
};
export
*
from
'
./src/logger.js
'
;
export
{
AdapterLitElement
}
from
'
./src/adapter-lit-element.js
'
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment