Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(table-of-contents): support dark theme #4213

Merged
merged 4 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 18 additions & 195 deletions packages/react/src/__tests__/__snapshots__/storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -96636,6 +96636,7 @@ exports[`Storyshots Components|Table of Contents Dynamic Items 1`] = `
data-floating-menu-container=""
role="main"
>
<style />
<ManuallyDefineMenuItems
parameters={
Object {
Expand Down Expand Up @@ -96813,20 +96814,8 @@ exports[`Storyshots Components|Table of Contents Dynamic Items 1`] = `
<a
data-title="Cras molestie condimentum"
name="8"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Cras molestie condimentum
</h3>
</a>
Expand All @@ -96842,20 +96831,8 @@ exports[`Storyshots Components|Table of Contents Dynamic Items 1`] = `
<a
data-title="Praesent fermentum sodales"
name="7"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Praesent fermentum sodales
</h3>
</a>
Expand All @@ -96871,20 +96848,8 @@ exports[`Storyshots Components|Table of Contents Dynamic Items 1`] = `
<a
data-title="Nulla tristique lacinia"
name="2"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Nulla tristique lacinia
</h3>
</a>
Expand All @@ -96900,20 +96865,8 @@ exports[`Storyshots Components|Table of Contents Dynamic Items 1`] = `
<a
data-title="Morbi id nibh metus"
name="3"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Morbi id nibh metus
</h3>
</a>
Expand All @@ -96929,20 +96882,8 @@ exports[`Storyshots Components|Table of Contents Dynamic Items 1`] = `
<a
data-title="Integer non scelerisque"
name="14"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Integer non scelerisque
</h3>
</a>
Expand Down Expand Up @@ -96982,6 +96923,7 @@ exports[`Storyshots Components|Table of Contents Manually define Menu Items 1`]
data-floating-menu-container=""
role="main"
>
<style />
<TableOfContents
menuItems={null}
menuLabel="Jump to"
Expand Down Expand Up @@ -97136,20 +97078,8 @@ exports[`Storyshots Components|Table of Contents Manually define Menu Items 1`]
<a
data-title="Cras molestie condimentum"
name="8"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Cras molestie condimentum
</h3>
</a>
Expand All @@ -97165,20 +97095,8 @@ exports[`Storyshots Components|Table of Contents Manually define Menu Items 1`]
<a
data-title="Praesent fermentum sodales"
name="7"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Praesent fermentum sodales
</h3>
</a>
Expand All @@ -97194,20 +97112,8 @@ exports[`Storyshots Components|Table of Contents Manually define Menu Items 1`]
<a
data-title="Nulla tristique lacinia"
name="2"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Nulla tristique lacinia
</h3>
</a>
Expand All @@ -97223,20 +97129,8 @@ exports[`Storyshots Components|Table of Contents Manually define Menu Items 1`]
<a
data-title="Morbi id nibh metus"
name="3"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Morbi id nibh metus
</h3>
</a>
Expand All @@ -97252,20 +97146,8 @@ exports[`Storyshots Components|Table of Contents Manually define Menu Items 1`]
<a
data-title="Integer non scelerisque"
name="14"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Integer non scelerisque
</h3>
</a>
Expand Down Expand Up @@ -97304,6 +97186,7 @@ exports[`Storyshots Components|Table of Contents With Heading Content 1`] = `
data-floating-menu-container=""
role="main"
>
<style />
<ManuallyDefineMenuItems
parameters={
Object {
Expand Down Expand Up @@ -97711,20 +97594,8 @@ exports[`Storyshots Components|Table of Contents With Heading Content 1`] = `
<a
data-title="Cras molestie condimentum"
name="8"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Cras molestie condimentum
</h3>
</a>
Expand All @@ -97740,20 +97611,8 @@ exports[`Storyshots Components|Table of Contents With Heading Content 1`] = `
<a
data-title="Praesent fermentum sodales"
name="7"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Praesent fermentum sodales
</h3>
</a>
Expand All @@ -97769,20 +97628,8 @@ exports[`Storyshots Components|Table of Contents With Heading Content 1`] = `
<a
data-title="Nulla tristique lacinia"
name="2"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Nulla tristique lacinia
</h3>
</a>
Expand All @@ -97798,20 +97645,8 @@ exports[`Storyshots Components|Table of Contents With Heading Content 1`] = `
<a
data-title="Morbi id nibh metus"
name="3"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Morbi id nibh metus
</h3>
</a>
Expand All @@ -97827,20 +97662,8 @@ exports[`Storyshots Components|Table of Contents With Heading Content 1`] = `
<a
data-title="Integer non scelerisque"
name="14"
style={
Object {
"color": "#000",
}
}
>
<h3
style={
Object {
"paddingBottom": "1rem",
"paddingTop": "2rem",
}
}
>
<h3>
Integer non scelerisque
</h3>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import DataContent from './data/DataContent';
import Image from '../../Image/Image';
import React from 'react';
import readme from '../README.stories.mdx';
import styles from './TableOfContents.stories.scss';
import TableOfContents from '../TableOfContents';

const sources = [
Expand All @@ -33,7 +34,14 @@ const longDescription = 'Lorem Ipsum Dolor';

export default {
title: 'Components|Table of Contents',

decorators: [
story => (
<>
<style>{styles.cssText}</style>
{story()}
</>
),
],
parameters: {
...readme.parameters,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// Copyright IBM Corp. 2020
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@import 'carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/colors/colors';
@import 'carbon-components/scss/globals/scss/typography';

a[name] {
display: block;
color: $text-01;
}

h3 {
padding-top: rem(16px);
padding-bottom: rem(32px);
}
Loading