• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

oetherington / bluesky-embed-react / 12322397256

13 Dec 2024 08:15PM UTC coverage: 50.205% (-6.6%) from 56.762%
12322397256

push

github

web-flow
Merge pull request #16 from oetherington/dependabot/npm_and_yarn/storybook/addon-essentials-8.4.7

Bump @storybook/addon-essentials from 8.4.5 to 8.4.7

44 of 123 branches covered (35.77%)

Branch coverage included in aggregate %.

201 of 365 relevant lines covered (55.07%)

43.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.56
/src/components/BlueskySegment.tsx
1
import React, { FC } from "react";
2
import type { RichTextSegment } from "@atproto/api";
3
import {
4
        getBlueskyLinkProps,
5
        getBlueskyProfileUrl,
6
        getBlueskyTagUrl,
7
} from "../helpers";
8
import { useBlueskyConfig } from "../hooks/useBlueskyConfig";
9
import { useHoverDecoration } from "../hooks/useHoverDecoration";
10

11
export type BlueskySegmentProps = {
12
        segment: RichTextSegment;
13
};
14

15
export const BlueskySegment: FC<BlueskySegmentProps> = ({ segment }) => {
30✔
16
        const { app, anchorColor, openLinksInNewTab } = useBlueskyConfig();
×
17
        const eventHandlers = useHoverDecoration();
×
18
        const anchorProps = {
×
19
                ...eventHandlers,
20
                ...getBlueskyLinkProps(openLinksInNewTab),
21
                style: {
22
                        color: anchorColor,
23
                        textDecoration: "none",
24
                },
25
        };
26

27
        if (segment.isLink()) {
×
28
                return (
×
29
                        <a href={segment.link?.uri} {...anchorProps}>
30
                                {segment.text}
31
                        </a>
32
                );
33
        }
34

35
        if (segment.isMention()) {
×
36
                return (
×
37
                        <a
38
                                href={getBlueskyProfileUrl(app, segment.mention?.did ?? "")}
×
39
                                {...anchorProps}
40
                        >
41
                                {segment.text}
42
                        </a>
43
                );
44
        }
45

46
        if (segment.isTag()) {
×
47
                return (
×
48
                        <a href={getBlueskyTagUrl(app, segment.tag?.tag ?? "")} {...anchorProps}>
×
49
                                {segment.text}
50
                        </a>
51
                );
52
        }
53

54
        return <span>{segment.text}</span>;
×
55
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc