-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat(odyssey-react-mui): add overline typography variant #2349
base: main
Are you sure you want to change the base?
Changes from 3 commits
463033f
3f101af
59cb5f5
c356634
41b5e4f
41dd73e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*! | ||
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved. | ||
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") | ||
* | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* | ||
* See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
import { render, screen } from "@testing-library/react"; | ||
import { Typography } from "./Typography"; | ||
|
||
describe("Typography", () => { | ||
test("renders overline", () => { | ||
render( | ||
<Typography ariaLabel="overline" variant="overline"> | ||
Overline test | ||
</Typography>, | ||
); | ||
|
||
expect(screen.getByLabelText("overline")).toBeVisible(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3111,6 +3111,7 @@ export const components = ({ | |||||||||||||||||||||
body1: "p", | ||||||||||||||||||||||
inherit: "p", | ||||||||||||||||||||||
legend: "legend", | ||||||||||||||||||||||
overline: "p", | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
styleOverrides: { | ||||||||||||||||||||||
|
@@ -3121,6 +3122,18 @@ export const components = ({ | |||||||||||||||||||||
marginBlockEnd: 0, | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
overline: { | ||||||||||||||||||||||
letterSpacing: 0.5, | ||||||||||||||||||||||
textTransform: "none", | ||||||||||||||||||||||
|
||||||||||||||||||||||
"html:lang(en) &": { | ||||||||||||||||||||||
textTransform: "uppercase", | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
|
||||||||||||||||||||||
"html:lang(en-*) &": { | ||||||||||||||||||||||
textTransform: "uppercase", | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want this instead since we always want these to share changes?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @KevinGhadyani-Okta Strangely, this doesn't work. I had to make 2 declarations for this to work correctly. I don't know why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to combine these selectors in quite a few ways to get it working. No luck |
||||||||||||||||||||||
}, | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -19,10 +19,11 @@ import { | |||||
Heading4, | ||||||
Heading5, | ||||||
Heading6, | ||||||
Legend, | ||||||
Overline, | ||||||
Paragraph, | ||||||
Subordinate, | ||||||
Support, | ||||||
Legend, | ||||||
TypographyProps, | ||||||
typographyColorValues, | ||||||
typographyVariantMapping, | ||||||
|
@@ -40,9 +41,10 @@ const variantMapping = { | |||||
h5: Heading5, | ||||||
h6: Heading6, | ||||||
body: Paragraph, | ||||||
legend: Legend, | ||||||
overline: Overline, | ||||||
subordinate: Subordinate, | ||||||
support: Support, | ||||||
legend: Legend, | ||||||
}; | ||||||
|
||||||
const storybookMeta: Meta<TypographyProps> = { | ||||||
|
@@ -234,6 +236,30 @@ export const BodyStory: StoryObj<TypographyProps> = { | |||||
}, | ||||||
}; | ||||||
|
||||||
export const LegendStory: StoryObj<TypographyProps> = { | ||||||
name: "Legend", | ||||||
args: { | ||||||
children: "This is a legend", | ||||||
variant: "legend", | ||||||
}, | ||||||
render: (args) => <Legend {...args} children={args.children} />, | ||||||
play: async ({}) => { | ||||||
await axeRun("Typopgraphy legend"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
}, | ||||||
}; | ||||||
|
||||||
export const OverlineStory: StoryObj<TypographyProps> = { | ||||||
name: "Overline", | ||||||
args: { | ||||||
children: "This is an Overline", | ||||||
variant: "overline", | ||||||
}, | ||||||
render: (args) => <Overline {...args} children={args.children} />, | ||||||
play: async ({}) => { | ||||||
await axeRun("Typopgraphy Overline"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}, | ||||||
}; | ||||||
|
||||||
export const SubordinateStory: StoryObj<TypographyProps> = { | ||||||
name: "Subordinate", | ||||||
args: { | ||||||
|
@@ -258,18 +284,6 @@ export const SupportStory: StoryObj<TypographyProps> = { | |||||
}, | ||||||
}; | ||||||
|
||||||
export const LegendStory: StoryObj<TypographyProps> = { | ||||||
name: "Legend", | ||||||
args: { | ||||||
children: "This is a legend", | ||||||
variant: "legend", | ||||||
}, | ||||||
render: (args) => <Legend {...args} children={args.children} />, | ||||||
play: async ({}) => { | ||||||
await axeRun("Typopgraphy legend"); | ||||||
}, | ||||||
}; | ||||||
|
||||||
export const ColorStory: StoryObj<TypographyProps> = { | ||||||
name: "Color", | ||||||
render: ({}) => { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.