diff --git a/WHATSNEW.md b/WHATSNEW.md index 22fc318797..152467c6c0 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -1,6 +1,4 @@ -## v3.7.3 - -## v3.7.2 +## v3.7.2 - [Card] Support AreaRestricted for MinimalStyle also ([#2170](https://github.com/microsoft/fluentui-blazor/pull/2170)) - [ComboBox] bind-SelectedOption is null when using bind-SelectedOption:after ([#2102](https://github.com/microsoft/fluentui-blazor/pull/2102)) - [DataGrid] Allow programmatic sorting of columns by name or index ([#2156](https://github.com/microsoft/fluentui-blazor/pull/2156)) diff --git a/examples/Demo/Shared/Components/MarkdownSection.razor.css b/examples/Demo/Shared/Components/MarkdownSection.razor.css new file mode 100644 index 0000000000..06931bd9ca --- /dev/null +++ b/examples/Demo/Shared/Components/MarkdownSection.razor.css @@ -0,0 +1,62 @@ +::deep th { + padding: 0 5px 0 5px; + border-width: 1px; +} + +::deep td { + padding: 0 5px 0 5px; + border-width: 1px; +} + +::deep .snippet { + margin-bottom: 0.5rem; + border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-rest); + border-radius: calc(var(--control-corner-radius) * 1px); + overflow-y: auto; +} + +::deep .hljs { + background-color: var(--neutral-layer-2); + tab-size: 2em; +} + +::deep .hljs-copy-button { + border-color: var(--neutral-fill-strong-rest); + color: var(--accent-fill-rest); + top: 0.4rem; + /*background-color: var(--neutral-layer-2) !important;*/ + /*background-image: url('data:image/svg+xml;utf-8,');*/ +} + + ::deep .hljs-copy-button:hover { + border-color: var(--neutral-fill-strong-hover); + } + + ::deep .hljs-copy-button:active { + border-color: var(--neutral-fill-strong-active); + } + +::deep .hljs-copy { + cursor: pointer; + border-color: var(--neutral-stroke-rest); + border-radius: calc(var(--control-corner-radius) * 1px); + color: var(--accent-fill-rest); + background-color: var(--neutral-layer-2); + top: 0.4rem; +} + +::deep .hljs-copy { + position: absolute; + transform: translateX(calc(100% + 1.125em)); + right: 1em; + transition: background-color 200ms ease, transform 200ms ease-out; +} + +::deep .hljs-copy-wrapper { + position: relative; + overflow: hidden +} + + ::deep .hljs-copy-wrapper:hover .hljs-copy, .hljs-copy:focus { + transform: translateX(0); + } diff --git a/examples/Demo/Shared/Components/MarkdownSection.razor.js b/examples/Demo/Shared/Components/MarkdownSection.razor.js new file mode 100644 index 0000000000..fa6a271cf6 --- /dev/null +++ b/examples/Demo/Shared/Components/MarkdownSection.razor.js @@ -0,0 +1,30 @@ +export function highlight() { + var preTagList = document.getElementsByTagName('pre'); + var numberOfPreTags = preTagList.length; + for (var i = 0; i < numberOfPreTags; i++) { + var codeTag = preTagList[i].getElementsByTagName('code'); + hljs.highlightElement(codeTag[0]); + } +} + +export function addCopyButton() { + var snippets = document.querySelectorAll('.snippet'); + var numberOfSnippets = snippets.length; + for (var i = 0; i < numberOfSnippets; i++) { + let copyButton = snippets[i].getElementsByClassName("hljs-copy") + if (copyButton.length === 0) { + let code = snippets[i].getElementsByTagName('code')[0].innerText; + snippets[i].innerHTML = snippets[i].innerHTML + ''; // append copy button + + copyButton[0].addEventListener("click", function () { + navigator.clipboard.writeText(code); + + this.innerText = 'Copied!'; + let button = this; + setTimeout(function () { + button.innerText = 'Copy'; + }, 1000) + }); + } + } +} diff --git a/examples/Demo/Shared/wwwroot/docs/WhatsNew.md b/examples/Demo/Shared/wwwroot/docs/WhatsNew.md index a91908a269..8e23369ffb 100644 --- a/examples/Demo/Shared/wwwroot/docs/WhatsNew.md +++ b/examples/Demo/Shared/wwwroot/docs/WhatsNew.md @@ -1,6 +1,4 @@ -## v3.7.3 - -## v3.7.2 +## v3.7.2 - [Card] Support AreaRestricted for MinimalStyle also ([#2170](https://github.com/microsoft/fluentui-blazor/pull/2170)) - [ComboBox] bind-SelectedOption is null when using bind-SelectedOption:after ([#2102](https://github.com/microsoft/fluentui-blazor/pull/2102)) - [DataGrid] Allow programmatic sorting of columns by name or index ([#2156](https://github.com/microsoft/fluentui-blazor/pull/2156))