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

feat: support initial and hide #56

Merged
merged 1 commit into from
Aug 20, 2024
Merged

feat: support initial and hide #56

merged 1 commit into from
Aug 20, 2024

Conversation

v8tenko
Copy link
Member

@v8tenko v8tenko commented Aug 12, 2024

No description provided.

@v8tenko v8tenko force-pushed the add-initial-and-hide branch from e6ea43c to a75c197 Compare August 12, 2024 10:25
);
}

function matchProps(token: Token) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function trim(string) {
    return string.trim();
}

function unquote(string) {
    return string.match(/^(["']).*\1$/) ? string.slice(1, -1) : string;
}

function props(string) {
    string = trim(string.replace('list tabs', ''));

    const props = string.split(' ');
    const result = {
        orientation: 'horizontal',
        group: `${DEFAULT_TABS_GROUP_PREFIX}${generateID()}`
    };

    for (const prop of props) {
        const [key, value] = prop.split('=').map(trim);

        switch (key) {
            case 'horizontal':
            case 'radio':
                result.orientation = key;
                break;
            case 'group':
                result.group = unquote(value);
                break;
            case 'focus':
                // TODO: lint missed tab id
                result.focus = unquote(value);
                break;
            default:
                // TODO: lint unknown tabs props
        }
    }

    return result;
}

@v8tenko v8tenko force-pushed the add-initial-and-hide branch 2 times, most recently from 732a136 to 412380d Compare August 20, 2024 09:47
@v8tenko v8tenko force-pushed the add-initial-and-hide branch from 412380d to 6cd7fa5 Compare August 20, 2024 09:55
@v8tenko v8tenko merged commit 3b59a67 into master Aug 20, 2024
2 checks passed
@v8tenko v8tenko deleted the add-initial-and-hide branch August 20, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants