Navigation Menu

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

Add support for table tags #54

Merged
merged 21 commits into from Oct 24, 2021
Merged

Add support for table tags #54

merged 21 commits into from Oct 24, 2021

Conversation

butschster
Copy link
Contributor

@butschster butschster commented Oct 13, 2021

render(<<<'HTML'
<table style="box-double">
    <thead title="Books" class="bg-red text-color-white px-10">
        <tr>
            <th align="right">ISBN</th>
            <th>Title</th>
            <th>Author</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th align="right">99921-58-10-7</th>
            <td>Divine Comedy</td>
            <td align="right">Dante Alighieri</td>
        </tr>
        <tr border="1">
            <th class="bg-blue text-color-red" align="right">9971-5-0210-0</th>
            <td>A Tale of Two Cities</td>
            <td align="right">Charles Dickens</td>
        </tr>
        <tr>
            <th align="right">960-425-059-0</th>
            <td>The Lord of the Rings</td>
            <td align="right">J. R. R. Tolkien</td>
        </tr>
        <tr>
            <th align="right">80-902734-1-6</th>
            <td>And Then There Were None</td>
            <td rowspan="2" align="right">Dante Alighieri\nspans multiple rows</td>
        </tr>
        <tr>
            <th align="right">978-052156781</th>
            <td>De Monarchia</td>
        </tr>
    </tbody>
    <tfoot title="Page 1/2" class="mx-5 bg-blue">
        <tr>
            <th colspan="3">This value spans 3 columns.</th>
        </tr>
    </tfoot>
</table>
HTML);

Will render
table

@butschster butschster changed the title Added support for table tags Add support for table tags Oct 13, 2021
@butschster
Copy link
Contributor Author

I've completely forgot about table properties.

has one of symfony table styles. See https://github.com/symfony/console/blob/5.3/Helper/Table.php#L843

I added also support for colspan, rowspan

@xiCO2k
Copy link
Collaborator

xiCO2k commented Oct 13, 2021

Awesome, Thanks @butschster.

- header and footer title
- row separator
- tfoot
- th tag will add bold style for text
@butschster
Copy link
Contributor Author

Awesome, Thanks @butschster.

I've just added couple of new features and also replaced table. I got an example from symfpny docs

Now you can use <tr border="1">,  <tr border="2">, ...

Added ability to configure title for header and footer.
<thead title="Books" class="bg-red text-color-white px-10">
<tfoot title="Page 1/2" class="mx-5 bg-blue">
@butschster
Copy link
Contributor Author

I've just added some of useful features.

  1. Replaces <hr> with border attribute for table row separator.
    Now you can used border attribute for tr and specify how many table separators you want to add
<tr border="2">
  ...
</tr>
  1. Added ability to configure title for header and footer.

Now you can use class attribute for thead and tfoot for title style configuration

<thead title="Books" class="bg-red text-color-white px-10">
        ...
</thead>
<tfoot title="Page 1/2" class="mx-5 bg-blue">
        ...
</tfoot>

@butschster
Copy link
Contributor Author

butschster commented Oct 14, 2021

Frame 2

@xiCO2k
Copy link
Collaborator

xiCO2k commented Oct 14, 2021

Great printscreen haha 👌

@butschster
Copy link
Contributor Author

Great printscreen haha 👌

It's figma :) I liked your one.

@xiCO2k xiCO2k marked this pull request as draft October 20, 2021 14:51
@xiCO2k
Copy link
Collaborator

xiCO2k commented Oct 20, 2021

Made it to be a draft since you are still working, on it. also keep in mind if pull request #60 is merged you may need to rebase.

Keep up the good work! thanks @butschster.

@butschster butschster marked this pull request as ready for review October 20, 2021 15:13
@butschster
Copy link
Contributor Author

Made it to be a draft since you are still working, on it. also keep in mind if pull request #60 is merged you may need to rebase.

Keep up the good work! thanks @butschster.

Oh, I didn't notice your message. Ok, I'll rebase last commits soon

@butschster
Copy link
Contributor Author

@xiCO2k done

Copy link
Collaborator

@xiCO2k xiCO2k left a comment

Choose a reason for hiding this comment

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

Looks good to me, only those two tweaks I mention. Thanks

src/Html/TableRenderer.php Outdated Show resolved Hide resolved
tests/table.php Outdated Show resolved Hide resolved
@butschster
Copy link
Contributor Author

butschster commented Oct 24, 2021

@xiCO2k I fixed problem with hex colors and left a comment. This TODO will be fixed via #64

@xiCO2k
Copy link
Collaborator

xiCO2k commented Oct 24, 2021

Looks good to me. @nunomaduro can you take a look on this?

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/Components/Raw.php Outdated Show resolved Hide resolved
src/Html/TableRenderer.php Outdated Show resolved Hide resolved
src/Html/TableRenderer.php Outdated Show resolved Hide resolved
src/Html/TableRenderer.php Outdated Show resolved Hide resolved
src/Html/TableRenderer.php Show resolved Hide resolved
src/Html/TableRenderer.php Show resolved Hide resolved
Copy link
Owner

@nunomaduro nunomaduro left a comment

Choose a reason for hiding this comment

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

Just remove the changes on the readme, and you can merge this @xiCO2k .

@butschster
Copy link
Contributor Author

Just remove the changes on the readme, and you can merge this @xiCO2k .

Done

@nunomaduro nunomaduro merged commit c98b6d6 into nunomaduro:master Oct 24, 2021
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.

None yet

3 participants