-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: iss 462/viv 220 inline native elements (#464)
* issue #462: initial take on code element * issue #462: basic HTML elements styling * issue #462: styling the base HTML elements with Vivid context * issue #462: inline native elements styling * issue #462: fixing the code style color * issue #462: setting the color value via the common base names set * issue #462: fixing the deps check issues * issue #462: adjusting the colors * issue #462: adjusting the latest changes in schemes
- Loading branch information
Showing
9 changed files
with
72 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,10 @@ | |
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
} | ||
|
||
code { | ||
padding: 3px 4px; | ||
border-radius: 6px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
@use '@vonage/vvd-design-tokens/build/scss/semantic-variables/scheme-variables'; | ||
@use '@vonage/vvd-foundation/scss/variable-names/color-base-variable-names' as color-base; | ||
|
||
@mixin scheme-variables-coupling { | ||
body { | ||
background-color: var(#{scheme-variables.$vvd-color-base}); | ||
color: var(#{scheme-variables.$vvd-color-on-base}); | ||
} | ||
} | ||
|
||
code { | ||
background-color:var(#{scheme-variables.$vvd-color-surface}); | ||
color: color-base.$orange-600; | ||
} | ||
|
||
a { | ||
color: color-base.$purple-600; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
import '@vonage/vvd-core'; | ||
import { style } from './vvd-context.css'; | ||
|
||
init(); | ||
export default { | ||
install, | ||
}; | ||
|
||
function init(): void { | ||
injectGlobalStyle(); | ||
} | ||
const CONTEXT_STYLE_IDENTIFIER = 'vivid-context-style'; | ||
|
||
/** | ||
* installs Vivid context (styles) into the target scope | ||
*/ | ||
async function install(target = document): Promise<void> { | ||
if ( | ||
!target || | ||
(target.nodeType !== Node.DOCUMENT_NODE && | ||
target.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) | ||
) { | ||
throw new Error(`target document expected; got ${target}`); | ||
} | ||
|
||
const { style } = await import('./vvd-context.css'); | ||
|
||
let styleElement = target.querySelector(`.${CONTEXT_STYLE_IDENTIFIER}`); | ||
if (!styleElement) { | ||
styleElement = (target.ownerDocument ?? target).createElement('style'); | ||
} | ||
|
||
function injectGlobalStyle() { | ||
const globalStyleSheet = document.createElement('style'); | ||
globalStyleSheet.innerHTML = style.cssText; | ||
document.head.appendChild(globalStyleSheet); | ||
styleElement.innerHTML = style.cssText; | ||
(target.head || target).appendChild(styleElement); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ $purple-600: #871EFF; | |
$red-100: #fdecec; | ||
$red-600: #CD0D0D; | ||
$green-600: #167629; | ||
$orange-600: rgb(187,55,0); |