Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitade45f7

Browse files
committed
feat: create link component
1 parent8fd3ef3 commitade45f7

File tree

4 files changed

+76
-15
lines changed

4 files changed

+76
-15
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
importtype{Meta,StoryObj}from"@storybook/react";
2+
// import { userEvent, within } from "@storybook/test";
3+
import{Link}from"./Link";
4+
5+
constmeta:Meta<typeofLink>={
6+
title:"components/Link",
7+
component:Link,
8+
args:{
9+
text:"Learn more",
10+
},
11+
};
12+
13+
exportdefaultmeta;
14+
typeStory=StoryObj<typeofLink>;
15+
16+
exportconstDefault:Story={};
17+
18+
exportconstSmall:Story={
19+
args:{
20+
size:"sm",
21+
},
22+
};
23+
24+
// export const Hover: Story = {
25+
// play: async ({ canvasElement, step }) => {
26+
// const screen = within(canvasElement);
27+
28+
// await step("activate hover trigger", async () => {
29+
// await userEvent.hover(screen.getByRole("link", { name: /Learn more/i }));
30+
// });
31+
// },
32+
// };
33+

‎site/src/components/Link/Link.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import{typeVariantProps,cva}from"class-variance-authority";
2+
import{SquareArrowOutUpRight}from"lucide-react";
3+
import{forwardRef}from"react";
4+
import{cn}from"utils/cn";
5+
6+
exportconstlinkVariants=cva(
7+
`relative inline-flex items-center no-underline font-medium text-content-link
8+
after:hover:content-[''] after:hover:absolute after:hover:w-full after:hover:h-[1px] after:hover:bg-current after:hover:bottom-px
9+
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-content-link
10+
focus-visible:ring-offset-2 focus-visible:ring-offset-surface-primary focus-visible:rounded-sm
11+
visited:text-content-link`,
12+
{
13+
variants:{
14+
size:{
15+
lg:"text-sm mb-px",
16+
sm:"text-xs [&_svg]:size-icon-xs [&_svg]:p-px",
17+
},
18+
},
19+
defaultVariants:{
20+
size:"lg",
21+
},
22+
},
23+
);
24+
25+
exportinterfaceLinkProps
26+
extendsReact.AnchorHTMLAttributes<HTMLAnchorElement>,
27+
VariantProps<typeoflinkVariants>{
28+
text:string;
29+
}
30+
31+
exportconstLink=forwardRef<HTMLAnchorElement,LinkProps>(
32+
({ className, text, size, ...props},ref)=>{
33+
return(
34+
<aclassName={cn(linkVariants({ size}),className)}ref={ref}{...props}>
35+
{text}&nbsp;
36+
<SquareArrowOutUpRightsize={14}aria-hidden="true"/>
37+
</a>
38+
);
39+
},
40+
);

‎site/src/pages/ManagementSettingsPage/IdpSyncPage/IdpSyncPage.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import { ChooseOne, Cond } from "components/Conditionals/ChooseOne";
1111
import{EmptyState}from"components/EmptyState/EmptyState";
1212
import{displayError}from"components/GlobalSnackbar/utils";
1313
import{displaySuccess}from"components/GlobalSnackbar/utils";
14+
import{Link}from"components/Link/Link";
1415
import{Paywall}from"components/Paywall/Paywall";
15-
import{SquareArrowOutUpRight}from"lucide-react";
1616
import{useFeatureVisibility}from"modules/dashboard/useFeatureVisibility";
1717
import{useOrganizationSettings}from"modules/management/OrganizationSettingsLayout";
1818
import{typeFC,useEffect}from"react";
@@ -107,16 +107,9 @@ export const IdpSyncPage: FC = () => {
107107
<pclassName="flex flex-row gap-1 text-sm text-content-secondary font-medium m-0">
108108
Automatically assign groups or roles to a user based on their IdP
109109
claims.
110-
<a
111-
href={docs("/admin/users/idp-sync")}
112-
className="flex flex-row text-content-link items-center gap-1 no-underline hover:underline visited:text-content-link"
113-
>
114-
View docs
115-
<SquareArrowOutUpRightsize={14}/>
116-
</a>
110+
<Linktext="View docs"href={docs("/admin/users/idp-sync")}/>
117111
</p>
118112
</div>
119-
{/* <ExportPolicyButton syncSettings={orgSyncSettingsData} /> */}
120113
</header>
121114
<ChooseOne>
122115
<Condcondition={!isIdpSyncEnabled}>

‎site/src/pages/ManagementSettingsPage/IdpSyncPage/IdpSyncPageView.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -697,12 +697,7 @@ const TableLoader = () => {
697697

698698
constLegacyGroupSyncHeader:FC=()=>{
699699
return(
700-
<h4
701-
css={{
702-
fontSize:20,
703-
fontWeight:500,
704-
}}
705-
>
700+
<h4className="text-xl font-medium">
706701
<divclassName="flex items-end gap-2">
707702
<span>Legacy group sync settings</span>
708703
<HelpTooltip>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp